1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 08:43:40 -07:00

Fix browse-url-emacs for file: URLs on Windows

* lisp/net/browse-url.el (browse-url-emacs): Fix up
file:///c:/foo/bar URLs on windows (bug#58464).
This commit is contained in:
Lars Ingebrigtsen 2022-10-13 09:52:44 +02:00
parent 7054481ed5
commit 4af4df18c5

View 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)