]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix browse-url-emacs for file: URLs on Windows
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 13 Oct 2022 07:52:44 +0000 (09:52 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 13 Oct 2022 07:52:51 +0000 (09:52 +0200)
* lisp/net/browse-url.el (browse-url-emacs): Fix up
file:///c:/foo/bar URLs on windows (bug#58464).

lisp/net/browse-url.el

index 2d528c4862c9117554c21a417d633e15d317d57b..1597f3651a50c9f05d4c19d53ff061e9d7872e8f 100644 (file)
@@ -1294,6 +1294,11 @@ currently selected window instead."
         (let ((file (url-unhex-string (url-filename parsed))))
           (when-let ((coding (browse-url--file-name-coding-system)))
             (setq file (decode-coding-string file 'utf-8)))
+          ;; The local-part of file: URLs on Windows is supposed to
+          ;; start with an extra slash.
+          (when (eq system-type 'windows-nt)
+            (setq file (replace-regexp-in-string
+                        "\\`/\\([a-z]:\\)" "\\1" file)))
           (funcall func file))
       (let ((file-name-handler-alist
              (cons (cons url-handler-regexp 'url-file-handler)