]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix thinko in setting url-portspec
authorSteven Allen <steven@stebalien.com>
Sat, 15 Aug 2020 11:37:38 +0000 (13:37 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sat, 15 Aug 2020 11:37:38 +0000 (13:37 +0200)
* lisp/url/url-expand.el (url-default-expander): Set
`url-portspec' (bug#42869).

lisp/url/url-expand.el
test/lisp/url/url-expand-tests.el

index f34ef810c4a3317292e11d2bfee36fbfced44a16..be9b5426dc42726f4e61dc20d67f30d7634a3c67 100644 (file)
@@ -120,7 +120,7 @@ path components followed by `..' are removed, along with the `..' itself."
       ;; Well, they told us the scheme, let's just go with it.
       nil
     (setf (url-type urlobj) (or (url-type urlobj) (url-type defobj)))
-    (setf (url-port urlobj) (or (url-portspec urlobj)
+    (setf (url-portspec urlobj) (or (url-portspec urlobj)
                                 (and (string= (url-type urlobj)
                                               (url-type defobj))
                                     (url-port defobj))))
index 6e0ce8695025cb7520bb4ce7ada748fb809188d4..3b0b6fbd41a16b69b6d3a5d50b8256c5cf9e144c 100644 (file)
   (should (equal (url-expand-file-name "foo#bar" "http://host/foobar") "http://host/foo#bar"))
   (should (equal (url-expand-file-name "foo#bar" "http://host/foobar/") "http://host/foobar/foo#bar")))
 
+(ert-deftest url-expand-file-name/relative-resolution-file-url ()
+  "RFC 3986, Section 5.4 Reference Resolution Examples / Section 5.4.1. Normal Examples"
+  (should (equal (url-expand-file-name "bar.html"          "file:///a/b/c/foo.html") "file:///a/b/c/bar.html"))
+  (should (equal (url-expand-file-name "bar.html"          "file:///a/b/c/")         "file:///a/b/c/bar.html"))
+  (should (equal (url-expand-file-name "../d/bar.html"     "file:///a/b/c/")         "file:///a/b/d/bar.html"))
+  (should (equal (url-expand-file-name "../d/bar.html"     "file:///a/b/c/foo.html") "file:///a/b/d/bar.html")))
+
 (provide 'url-expand-tests)
 
 ;;; url-expand-tests.el ends here