[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] org-protocol: decode "+" in query part as space
From: |
Maxim Nikulin |
Subject: |
[PATCH] org-protocol: decode "+" in query part as space |
Date: |
Tue, 6 Apr 2021 21:47:43 +0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
Hi,
Some time ago, when I tried org-protocol, 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.
0001-org-protocol.el-decode-in-query-part-as-space.patch
Description: Text Data
- [PATCH] org-protocol: decode "+" in query part as space,
Maxim Nikulin <=