]> git.eshelyaron.com Git - emacs.git/commitdiff
Repair nXML handling of URIs with hex escapes (bug#58718)
authorMartin Jerabek <om@mailservice.ms>
Mon, 24 Oct 2022 10:02:20 +0000 (12:02 +0200)
committerMattias EngdegÄrd <mattiase@acm.org>
Mon, 24 Oct 2022 10:22:41 +0000 (12:22 +0200)
Copyright-paperwork-exempt: yes

* lisp/nxml/rng-uri.el (rng-uri-file-name-1): Add missing backslashes.
(rng-uri-unescape-unibyte, rng-uri-unescape-unibyte-match):
Convert hex-encoded character to string.

lisp/nxml/rng-uri.el

index 77fed8c32dac646a951428a049d48e22a320fcc3..59e696e2cc9c883f55062cb6f8af2a67af39c8da 100644 (file)
@@ -68,7 +68,7 @@ Signal an error if URI is not a valid file URL."
 
 ;; pattern is either nil or match or replace
 (defun rng-uri-file-name-1 (uri pattern)
-  (unless (string-match "\\`\\(?:[^%]\\|%[[:xdigit:]]{2}\\)*\\'" uri)
+  (unless (string-match "\\`\\(?:[^%]\\|%[[:xdigit:]]\\{2\\}\\)*\\'" uri)
     (rng-uri-error "Bad escapes in URI `%s'" uri))
   (setq uri (rng-uri-unescape-multibyte uri))
   (let* ((components
@@ -312,7 +312,7 @@ Both FULL and BASE must be absolute URIs."
 (defun rng-uri-unescape-unibyte (str)
   (replace-regexp-in-string "%[0-7][[:xdigit:]]"
                            (lambda (h)
-                             (string-to-number (substring h 1) 16))
+                             (string (string-to-number (substring h 1) 16)))
                            str
                            t
                            t))
@@ -325,8 +325,8 @@ Both FULL and BASE must be absolute URIs."
                                (regexp-quote
                                 (if (= (length match) 1)
                                     match
-                                  (string-to-number (substring match 1)
-                                                    16)))))
+                                  (string (string-to-number (substring match 1)
+                                                            16))))))
                            str
                            t
                            t))