emacs-bug-tracker
[Top][All Lists]
Advanced

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

bug#70312: closed ([PATCH] Avoid unnecessary escaping in url-build-query


From: GNU bug Tracking System
Subject: bug#70312: closed ([PATCH] Avoid unnecessary escaping in url-build-query-string)
Date: Thu, 18 Apr 2024 10:14:16 +0000

Your message dated Thu, 18 Apr 2024 13:10:57 +0300
with message-id <86zftrdlqm.fsf@gnu.org>
and subject line Re: bug#70312: [PATCH v2] Avoid unnecessary escaping in 
url-build-query-string
has caused the debbugs.gnu.org bug report #70312,
regarding [PATCH] Avoid unnecessary escaping in url-build-query-string
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
70312: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=70312
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] Avoid unnecessary escaping in url-build-query-string Date: Tue, 09 Apr 2024 15:29:00 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Hi,

While writing a custom URL function for git-link.el I noticed that
url-build-query-string unnecessarily escapes slashes in query parameter
values.  Here's a patch that fixes that by passing
url-query-allowed-chars to the url-hexify-string call.

- ilmari

>From ca1dbe67939ac78f5db06d746cd511928a138657 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dagfinn=20Ilmari=20Manns=C3=A5ker?= <ilmari@ilmari.org>
Date: Tue, 9 Apr 2024 15:02:45 +0100
Subject: [PATCH] Avoid unnecessary escaping in url-build-query-string

* lisp/url/url-util.el (url-build-query-string):
Pass url-query-allowed-chars to url-hexify-string to avoid unnecessarily
escaping characters that don't need to be escaped in a query string.
---
 lisp/url/url-util.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index 5f45b98c7a5..4fc0efcdf62 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -268,7 +268,8 @@ instead of just \"key\" as in the example above."
    (lambda (key-vals)
      (let ((escaped
             (mapcar (lambda (sym)
-                      (url-hexify-string (format "%s" sym))) key-vals)))
+                      (url-hexify-string (format "%s" sym) 
url-query-allowed-chars))
+                    key-vals)))
        (mapconcat (lambda (val)
                     (let ((vprint (format "%s" val))
                           (eprint (format "%s" (car escaped))))
-- 
2.39.2


--- End Message ---
--- Begin Message --- Subject: Re: bug#70312: [PATCH v2] Avoid unnecessary escaping in url-build-query-string Date: Thu, 18 Apr 2024 13:10:57 +0300
> From: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
> Date: Tue, 09 Apr 2024 17:41:07 +0100
> 
> I realised I'd forgotten to add tests, and that made me realise that
> url-query-allowed-chars is not correct for this, since that also
> contains '=', '&', and ';'. So here's an updated patch, which creates a
> new url-query-key-value-allowed-chars constant, which is
> url-query-allowed-chars minus the aforementioned three chars, and adds
> tests covering that, for both keys and values.

Thanks, I installed this on the master branch, and I'm closing this
bug.

With this contribution, you have exhausted the maximum amount of code
changes we can accept from you without a copyright assignment.  Would
you like to start your assignment paperwork now, so that we could
accept your future contributions without limitations?  If yes, I will
send you a form to fill and the instructions to go with it.


--- End Message ---

reply via email to

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