Describe the bug
"txt" URL parameter is not unescaped
To Reproduce
Steps to reproduce the behavior:
fsnotes://new/?title=Test+Note&txt=This+is+a+testnv://make/?title=Test+Note&txt=This+is+a+testfsc in https://github.com/glushchenko/fsnotes/wiki/Alfred-WorkflowExpected behavior
Should create a note with
Actual behavior
Creates a note with
That is, the txt parameter contents are not unescaped.
Desktop (please complete the following information):
@gingerbeardman valid escaping for "space" is %20, i.e nv://make/?title=URI-escaped-title&txt=This%20is%20a%20test
Actually both are valid escapes, but + is valid _only_ in URLs
https://stackoverflow.com/questions/2678551/when-to-encode-space-to-plus-or-20
I guess FSNotes should handle either?
But I'll change my Alfred Workflow.
Python urllib.quote_plus generated my test code.
urllib.parse.quote(string, safe='/', encoding=None, errors=None)
Replace special characters in string using the %xx escape. Letters, digits, and the characters '_.-~' are never quoted. By default, this function is intended for quoting the path section of URL. The optional safe parameter specifies additional ASCII characters that should not be quoted — its default value is '/'.string may be either a str or a bytes.
Changed in version 3.7: Moved from RFC 2396 to RFC 3986 for quoting URL strings. “~” is now included in the set of reserved characters.
The optional encoding and errors parameters specify how to deal with non-ASCII characters, as accepted by the str.encode() method. encoding defaults to 'utf-8'. errors defaults to 'strict', meaning unsupported characters raise a UnicodeEncodeError. encoding and errors must not be supplied if string is a bytes, or a TypeError is raised.
Note that quote(string, safe, encoding, errors) is equivalent to quote_from_bytes(string.encode(encoding, errors), safe).
Example: quote('/El Niño/') yields '/El%20Ni%C3%B1o/'.
urllib.parse.quote_plus(string, safe='', encoding=None, errors=None)
Like quote(), but also replace spaces by plus signs, as required for quoting HTML form values when building up a query string to go into a URL. Plus signs in the original string are escaped unless they are included in safe. It also does not have safe default to '/'.Example: quote_plus('/El Niño/') yields '%2FEl+Ni%C3%B1o%2F'.
Fixed, + replaced to space
Released in 3.5.0