emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] org-protocol: decode "+" in query part as space (v2)


From: Maxim Nikulin
Subject: Re: [PATCH] org-protocol: decode "+" in query part as space (v2)
Date: Thu, 29 Apr 2021 23:29:54 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

I have realized that only a half of new apostrophes in doc strings were properly escaped, so I am attaching updated patch. I still consider the change as a minor improvement.

On 06/04/2021 21:47, Maxim Nikulin wrote:

When I tried org-protocol for the first time, I was quite surprised that query parameters generated using URLSearchParams JavaScript class are decoded incorrectly. "+" characters representing space are passed as is. I hope, I have found a proper place in the code to handle such case.

It does not affect previously recommended bookmarklets with abundant calls of encodeURIComponent that escapes spaces as "%20". I believe, new option is more readable:

     javascript:location.href='org-protocol://capture?' +
         new URLSearchParams({
             template: 'x',
             url: location.href,
             title: document.title,
             body: window.getSelection()});

I guess, with old org-protocol syntax only pure percent encoding was necessary due to each parameter was represented as path component. "+" is allowed only in query part. Such variant was just missed when new query-like syntax was introduced.

Attachment: 0001-org-protocol.el-decode-in-query-part-as-space.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]