* 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.
(cherry picked from commit
bc5afe421b47ec31ce94ad8dc02912acd93c3319)
;; 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)))
(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)