Fsnotes: "txt" URL parameter does not like + escaped spaces

Created on 6 Aug 2019  ·  4Comments  ·  Source: glushchenko/fsnotes

Describe the bug
"txt" URL parameter is not unescaped

To Reproduce
Steps to reproduce the behavior:

Expected behavior
Should create a note with

  • title = Test Note
  • text = This is a test

Actual behavior
Creates a note with

  • title = Test Note
  • text = This+is+a+test

That is, the txt parameter contents are not unescaped.

Desktop (please complete the following information):

  • OS: macOS
  • OS version: 10.14.6
  • FSNotes version 3.3.7
bug done question

All 4 comments

@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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

peanutputter picture peanutputter  ·  4Comments

volt4ire picture volt4ire  ·  4Comments

ulab picture ulab  ·  3Comments

shurain picture shurain  ·  3Comments

gmenzel picture gmenzel  ·  3Comments