all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#70312: [PATCH] Avoid unnecessary escaping in url-build-query-string
@ 2024-04-09 14:29 Dagfinn Ilmari Mannsåker
  2024-04-09 16:41 ` bug#70312: [PATCH v2] " Dagfinn Ilmari Mannsåker
  0 siblings, 1 reply; 4+ messages in thread
From: Dagfinn Ilmari Mannsåker @ 2024-04-09 14:29 UTC (permalink / raw)
  To: 70312

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Avoid-unnecessary-escaping-in-url-build-query-string.patch --]
[-- Type: text/x-diff, Size: 1180 bytes --]

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-19 11:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-09 14:29 bug#70312: [PATCH] Avoid unnecessary escaping in url-build-query-string Dagfinn Ilmari Mannsåker
2024-04-09 16:41 ` bug#70312: [PATCH v2] " Dagfinn Ilmari Mannsåker
2024-04-18 10:10   ` Eli Zaretskii
2024-05-19 11:18   ` Philip Kaludercic

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.