From d044aebd1cc000a65cfcdec99c9effebe79d38bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Thu, 25 Sep 2025 14:18:43 +0200 Subject: [PATCH] v1.2.0 --- lib/dav4rack/request.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dav4rack/request.rb b/lib/dav4rack/request.rb index 0833bcb7..158374f7 100644 --- a/lib/dav4rack/request.rb +++ b/lib/dav4rack/request.rb @@ -105,7 +105,9 @@ module Dav4rack # path must be valid UTF-8 and will be url encoded by this method def url_for(rel_path, collection: false) path = path_for rel_path, collection: collection - "#{scheme}://#{host}:#{port}#{path}" + # do not include the port when it's the standard http(s) port + skip_port = (port == 80 && scheme == 'http') || (port == 443 && scheme == 'https') + "#{scheme}://#{host}#{":#{port}" unless skip_port}#{path}" end # returns an url encoded, absolute path for the given relative path