mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
url-parse.el: correct code for Windows paths (bug#76982)
* lisp/url/url-parse.el (url-recreate-url): Handle empty filenames without errors. * test/lisp/url/url-parse-tests.el (url-generic-parse-url/ms-windows-file-uri-hanlding): Add one more test for the scenario above.
This commit is contained in:
parent
c0491a8b80
commit
bc5afe421b
2 changed files with 9 additions and 2 deletions
|
|
@ -86,6 +86,7 @@ If the specified port number is the default, return nil."
|
|||
;; For Windows/DOS-like paths, `url-generic-parse-url' strips
|
||||
;; the leading /, so we need to add it back (bug#76982)
|
||||
(file (if (and (string= "file" type)
|
||||
(url-filename urlobj)
|
||||
(string-match "^[A-Za-z]:[/\\]" (url-filename urlobj)))
|
||||
(concat "/" (url-filename urlobj))
|
||||
(url-filename urlobj)))
|
||||
|
|
|
|||
|
|
@ -190,10 +190,16 @@
|
|||
(should (equal (url-filename
|
||||
(url-generic-parse-url "file:///c:\\directory\\file.txt"))
|
||||
"c:\\directory\\file.txt"))
|
||||
;;
|
||||
;; paths with hostname = "localhost" should work too
|
||||
(should (equal (url-filename
|
||||
(url-generic-parse-url "file://localhost/c:/path/to/file"))
|
||||
"c:/path/to/file")))
|
||||
"c:/path/to/file"))
|
||||
;; empty "file" url structs have to behave as they did before this fix
|
||||
(should (equal (url-recreate-url
|
||||
(url-parse-make-urlobj "file" nil nil "myhost" nil
|
||||
nil nil nil t))
|
||||
"file://myhost/")))
|
||||
|
||||
|
||||
(provide 'url-parse-tests)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue