On 15/05/2025 05:08, Charles Choi wrote:
emacsclient"org-protocol://capture?body=org-protocol://"
Ihor wrote about `server--process-filter-1', but another issue is usage
of `string-split' to find "org-protocol:..." in the argument. As a
result, when slashes are not encoded as %2F, org-protocol URLs in the
body cause partial capture.
A un-recommended workaround is to percent encode '/' to %2F. However,
this is arduous as different platform APIs (Python, Cocoa) when percent
encoding URL query parameters will treat '/' as having no reserved
purpose; they will/not/ percent encode '/'.
In JavaScript URLSearchParams encodes slash as %2F perhaps to be
compatible with application/x-www-form-urlencoded in POST requests.
Using python standard library the same result can be achieved as well:
urllib.parse.urlencode({
'body': 'Test of org-protocol:/capture?body=nested URL',
'url': 'https://example.org/'})
'body=Test+of+org-protocol%3A%2Fcapture%3Fbody%3Dnested+URL&url=https%3A%2F%2Fexample.org%2F'
P.S. Two slashes after URL scheme may cause treatment of next component
as authority (host name) and ambiguity concerning path component since
there is no slash before "?" query part delimiter.
org-protocol://capture?body=org
From my point of view, it is safer to use single slash
org-protocol:/capture?body=org
(Of course, I am not trying to dispute that the issue with passing
multiple slashes through emacsclient should be fixed.)