From: Max Nikulin <manikulin@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-protocol: decode "+" in query part as space (v3)
Date: Mon, 27 Sep 2021 22:07:06 +0700 [thread overview]
Message-ID: <sismmr$m3c$1@ciao.gmane.io> (raw)
In-Reply-To: <siskjm$sfs$1@ciao.gmane.io>
[-- Attachment #1: Type: text/plain, Size: 619 bytes --]
On 27/09/2021 21:31, Max Nikulin wrote:
> On 27/09/2021 17:38, Bastien wrote:
>> Maxim Nikulin writes:
>>
>>> 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.
>>
>> Probably given the delay, the patch does not apply anymore.
>>
>> Would you be able to reformat and resend it?
>
> Surprisingly there is no conflicts during rebase. I expected changed
> context in ORG-NEWS.
I had some test cases for decoding of "+" in org-protocol URIs, so I
have put them to test-org-protocol.el.
[-- Attachment #2: 0001-test-org-protocol.el-Decode-to-tests.patch --]
[-- Type: text/x-patch, Size: 2564 bytes --]
From 55d5128add97e7ef73f41eb52f4dccfedbeabc6b Mon Sep 17 00:00:00 2001
From: Max Nikulin <manikulin@gmail.com>
Date: Mon, 27 Sep 2021 22:02:09 +0700
Subject: [PATCH] test-org-protocol.el: Decode "+" to " " tests
testing/lisp/test-org-protocol.el
(test-org-protocol/org-protocol-store-link)
(test-org-protocol/org-protocol-capture): Cases to check that "+" is
decoded to space in query parameters (new style of URIs) but preserved
in path components (old style of org-protocol links).
---
testing/lisp/test-org-protocol.el | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/testing/lisp/test-org-protocol.el b/testing/lisp/test-org-protocol.el
index d33052b30..95fc7f862 100644
--- a/testing/lisp/test-org-protocol.el
+++ b/testing/lisp/test-org-protocol.el
@@ -76,7 +76,15 @@
;; New link style
(let ((uri "/some/directory/org-protocol://store-link?url=URL3&title=TITLE3"))
(should (null (org-protocol-check-filename-for-protocol uri (list uri) nil)))
- (should (equal (car org-stored-links) '("URL3" "TITLE3")))))
+ (should (equal (car org-stored-links) '("URL3" "TITLE3"))))
+ ;; Do not decode "+" in old-style link
+ (let ((uri "/org-protocol:/store-link:/one+one/plus+preserved"))
+ (should (null (org-protocol-check-filename-for-protocol uri (list uri) nil)))
+ (should (equal (car org-stored-links) '("one+one" "plus+preserved"))))
+ ;; Decode "+" to space in new-style link
+ (let ((uri "/org-protocol:/store-link/?url=one+two&title=plus+is+space"))
+ (should (null (org-protocol-check-filename-for-protocol uri (list uri) nil)))
+ (should (equal (car org-stored-links) '("one two" "plus is space")))))
(ert-deftest test-org-protocol/org-protocol-store-link-file ()
"store-link: `org-protocol-sanitize-uri' could distort URL."
@@ -133,6 +141,12 @@
;; - query parameters, not sure how to include them in template
("/some/directory/org-protocol:/capture?template=x&url=URL&title=TITLE&body=BODY&from=example"
. "** SOMEDAY\n\nBODY\n\n[[URL][TITLE]]\n")
+ ;; - "+" is not decoded to space in old-style URIs
+ ("/org-protocol:/capture:/t/https%3A%2F%2Forgmode.org%2Fsome+thing/org+mode/Body+plus"
+ . "** TODO\n\nBody+plus\n\n[[https://orgmode.org/some+thing][org+mode]]\n")
+ ;; - decode "+" to space
+ ("/org-protocol:/capture?template=t&url=URL&title=Mailing+list&body=Body+no+plus"
+ . "** TODO\n\nBody no plus\n\n[[URL][Mailing list]]\n")
)))
;; Old link style
(mapc
--
2.25.1
next prev parent reply other threads:[~2021-09-27 15:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 14:47 [PATCH] org-protocol: decode "+" in query part as space Maxim Nikulin
2021-04-29 16:29 ` [PATCH] org-protocol: decode "+" in query part as space (v2) Maxim Nikulin
2021-09-27 10:38 ` Bastien
2021-09-27 14:31 ` [PATCH] org-protocol: decode "+" in query part as space (v3) Max Nikulin
2021-09-27 15:07 ` Max Nikulin [this message]
2021-09-27 15:52 ` Bastien
2021-09-27 15:52 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='sismmr$m3c$1@ciao.gmane.io' \
--to=manikulin@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).