emacs-devel
[Top][All Lists]
Advanced

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

Re: browse-url and URL handlers (MS-Windows)


From: Eli Zaretskii
Subject: Re: browse-url and URL handlers (MS-Windows)
Date: Tue, 11 Oct 2022 19:36:50 +0300

> From: Augusto Stoffel <arstoffel@gmail.com>
> Cc: emacs-devel@gnu.org
> Date: Tue, 11 Oct 2022 14:32:21 +0200
> 
> > Type C-c C-c or C-c C-x to view the image as an image or hex.
> > Cannot display image: ( *mm*-273075 1 8193)
> > #<buffer kk01.jpg>
> >
> > I don't konw if this is because of the incorrectly reported read error
> > when opening the file.  When the file content is displayed in the
> > buffer I can view the image with C-c C-c.
> 
> I've come across issues with file URLs in Windows before, and the
> problem was that
> 
>   (url-filename (url-generic-parse-url "file:///C:/some/file"))
> 
> returns "/C:/some/file", with an extra slash at the beginning.

Is the below the right fix?

diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el
index 91f47d0..cc3e236 100644
--- a/lisp/url/url-parse.el
+++ b/lisp/url/url-parse.el
@@ -201,6 +201,9 @@ url-generic-parse-url
            (when (looking-at "\\?")
              (skip-chars-forward "^#"))
            (setq file (buffer-substring save-pos (point)))
+            (if (and (eq system-type 'windows-nt)
+                     (string-match-p "/[A-Z]:/" file))
+                (setq file (substring file 1)))
            ;; 3.5 Fragment
            (when (looking-at "#")
              (let ((opoint (point)))



reply via email to

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