From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 4EnrIWneUWHjAAAAgWs5BA (envelope-from ) for ; Mon, 27 Sep 2021 17:08:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id YIyvHWneUWHuSgAA1q6Kng (envelope-from ) for ; Mon, 27 Sep 2021 15:08:25 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D0A4C1A4E5 for ; Mon, 27 Sep 2021 17:08:24 +0200 (CEST) Received: from localhost ([::1]:48288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mUsEx-00018q-Ee for larch@yhetil.org; Mon, 27 Sep 2021 11:08:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53126) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUsDw-00016U-CN for emacs-orgmode@gnu.org; Mon, 27 Sep 2021 11:07:20 -0400 Received: from ciao.gmane.io ([116.202.254.214]:33852) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mUsDu-0008HN-Gv for emacs-orgmode@gnu.org; Mon, 27 Sep 2021 11:07:20 -0400 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mUsDs-00068T-C4 for emacs-orgmode@gnu.org; Mon, 27 Sep 2021 17:07:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: Max Nikulin Subject: Re: [PATCH] org-protocol: decode "+" in query part as space (v3) Date: Mon, 27 Sep 2021 22:07:06 +0700 Message-ID: References: <878rzie21k.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------F8CDCC6D7F4E0B2BAE20EC33" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -2 X-Spam_score: -0.3 X-Spam_bar: / X-Spam_report: (-0.3 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FORGED_MUA_MOZILLA=2.309, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-3.136, NML_ADSP_CUSTOM_MED=0.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632755304; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=pugBf7CEbCS2q8UqUcHpq0FVmOgz9FqQebZhdyfhLik=; b=B5ZChh7IbdlKHjk74RjiLKaV67ZCQR2Ncl3I6looL4h/f4HFHPaRDzzKc9NTTUtQto/m1M /AFk3xcB/Cgvasv/R0NBM5HbGphtG0KiUDAvYTNc/oaaLrVkq+9mQtpfII0v6M5rY3f76d M3WouhWBJAdBLM9FSBOM/jPJl/fu/X4JIcBRRbY3gXFaG41e9YPCOICcYVguo8ymCz8t43 m5wyRXG6fKhdLjsqzI6gL/H+ZZHbbtfVwNwIm0RBbnhW3zxN2wJByMb/TR+6uGFK+stlY5 651T6zjYRuCTO0utAK0s4/OgVCTdMdE1MVLcQhO0cK3VPTJs0ExIxkMgdhYxMw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632755304; a=rsa-sha256; cv=none; b=mx+SzHM6g7TTZRe1U+8eUJSJ7hTeXI6ZhhEbzYtBGtIETBvpujfaXb7MWB9lGjNjHYIrMd 66QFeqMOTjsffk0egaH/29FsHwg4N/HB9KZSyx/fEJatgbQX5eo6ndhnDgpQO7p0EifS/J eBpDMQOqSPYCbngeM7d/6HosGYT9mAIq9bRRdeN+N7iChwCsZaUV4Me0jbnjFukB6YNsvp 2EQmAtYbjvmWtt707tzuXOUSK2uTQuGAen0GaYVMDSc4OBWNkP5MFEI4xKzzAYZwNC3nqK 53rZOlxYAofIvep2/EJGscdv+l3XXoGNJsEjuqODbBQQgtpjDcrHgu7a4UMY8A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -0.29 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: D0A4C1A4E5 X-Spam-Score: -0.29 X-Migadu-Scanner: scn0.migadu.com X-TUID: RY+G3xN+Z6eP This is a multi-part message in MIME format. --------------F8CDCC6D7F4E0B2BAE20EC33 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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. --------------F8CDCC6D7F4E0B2BAE20EC33 Content-Type: text/x-patch; charset=UTF-8; name="0001-test-org-protocol.el-Decode-to-tests.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-test-org-protocol.el-Decode-to-tests.patch" >From 55d5128add97e7ef73f41eb52f4dccfedbeabc6b Mon Sep 17 00:00:00 2001 From: Max Nikulin 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 --------------F8CDCC6D7F4E0B2BAE20EC33--