unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#42869: [PATCH] Fix url-expand-file-name when applied to file:/// URLs
@ 2020-08-14 20:37 Steven Allen
  2020-08-15 11:37 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Allen @ 2020-08-14 20:37 UTC (permalink / raw)
  To: 42869

This code is supposed to update the portspec slot in the url object,
but was attempting to setf whatever url-port happened to return (not
necessarily the portspec slot).

* lisp/url/url-expand.el (url-default-expander): Set `url-portspec'.
---
 lisp/url/url-expand.el            | 2 +-
 test/lisp/url/url-expand-tests.el | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/lisp/url/url-expand.el b/lisp/url/url-expand.el
index f34ef810c4a..be9b5426dc4 100644
--- a/lisp/url/url-expand.el
+++ b/lisp/url/url-expand.el
@@ -120,7 +120,7 @@ url-default-expander
       ;; 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))))
diff --git a/test/lisp/url/url-expand-tests.el b/test/lisp/url/url-expand-tests.el
index 6e0ce869502..3b0b6fbd41a 100644
--- a/test/lisp/url/url-expand-tests.el
+++ b/test/lisp/url/url-expand-tests.el
@@ -100,6 +100,13 @@ url-expand-file-name/relative-resolution-additional-examples
   (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
-- 
2.28.0






^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#42869: [PATCH] Fix url-expand-file-name when applied to file:/// URLs
  2020-08-14 20:37 bug#42869: [PATCH] Fix url-expand-file-name when applied to file:/// URLs Steven Allen
@ 2020-08-15 11:37 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-15 11:37 UTC (permalink / raw)
  To: Steven Allen; +Cc: 42869

Steven Allen <steven@stebalien.com> writes:

> This code is supposed to update the portspec slot in the url object,
> but was attempting to setf whatever url-port happened to return (not
> necessarily the portspec slot).
>
> * lisp/url/url-expand.el (url-default-expander): Set `url-portspec'.

Thanks; applied to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-15 11:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-14 20:37 bug#42869: [PATCH] Fix url-expand-file-name when applied to file:/// URLs Steven Allen
2020-08-15 11:37 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).