#1806 closed enhancement (duplicate)

automatically url-decode capabilities in cli

Reported by: ChosenOne Owned by:
Priority: normal Milestone: undecided
Component: code-frontend-cli Version: 1.9.0
Keywords: usability newurls Cc:
Launchpad Bug:

Description

currently copy&paste from WUI to CLI messes things up, when capstrings come into play: my browser shows colons as %3A and I don't like replacing them every time.

How about the CLI automatically URL-decoding capstrings when required? I suppose that this might pose a few risk, so afaict a simple string capstr.replace("%3A",':') might suffice? Are there other special chars we'd need to take care of?

Change History (7)

comment:1 follow-up: Changed at 2012-09-14T17:21:16Z by zooko

Hm, uri.py already has a regex that accepts either : or %3A in those spots. Maybe we just need to make sure that the CLI passes the strings to uri.py instead of trying to parse the strings itself? What is the error that occurs when you paste a cap with "%3A" in it to the CLI?

comment:2 Changed at 2012-09-14T17:26:49Z by ChosenOne

  • Version changed from 1.9.2 to 1.9.0

comment:3 Changed at 2012-09-14T17:28:18Z by ChosenOne

Sorry, this is 1.9.0. Maybe it's already included in 1.9.2?

Here's the output

$ tahoe add-alias delme URI%3ADIR2%3Amchangethisay4wy7i%3Aocblablablawrongcapstringblablaq
Traceback (most recent call last):
  File "/home/freddy/opt/tahoe-lafs/src/allmydata/scripts/runner.py", line 117, in run
    rc = runner(sys.argv[1:], install_node_control=install_node_control)
  File "/home/freddy/opt/tahoe-lafs/src/allmydata/scripts/runner.py", line 102, in runner
    rc = cli.dispatch[command](so)
  File "/home/freddy/opt/tahoe-lafs/src/allmydata/scripts/cli.py", line 507, in add_alias
    rc = tahoe_add_alias.add_alias(options)
  File "/home/freddy/opt/tahoe-lafs/src/allmydata/scripts/tahoe_add_alias.py", line 48, in add_alias
    cap = uri.from_string_dirnode(cap).to_string()
  File "/home/freddy/opt/tahoe-lafs/src/allmydata/uri.py", line 949, in from_string_dirnode
    assert IDirnodeURI.providedBy(u)
AssertionError


comment:4 Changed at 2012-09-14T20:43:19Z by davidsarah

  • Keywords usability newurls added
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #942. I'll add a note to that ticket to say it applies to both the CLI and WUI (the latter doesn't accept URL-escaping in form fields).

comment:5 in reply to: ↑ 1 ; follow-up: Changed at 2012-09-14T20:54:13Z by davidsarah

Replying to zooko:

Hm, uri.py already has a regex that accepts either : or %3A in those spots. Maybe we just need to make sure that the CLI passes the strings to uri.py instead of trying to parse the strings itself? What is the error that occurs when you paste a cap with "%3A" in it to the CLI?

SEP, which contains the "%3A", is only used in the HUMAN_RE regex for each URI class, not for the STRING_RE regex. As far as I know the HUMAN_RE regexes are never used (I thought there was a cleanup ticket about that, but I can't find it if there is).

comment:6 in reply to: ↑ 5 Changed at 2012-09-14T21:03:07Z by davidsarah

Replying to davidsarah:

As far as I know the HUMAN_RE regexes are never used (I thought there was a cleanup ticket about that, but I can't find it if there is).

Filed as #1807.

comment:7 Changed at 2012-09-28T16:30:33Z by jg71

+1

Note: See TracTickets for help on using tickets.