aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/url.lua1
-rw-r--r--test/urltest.lua2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/url.lua b/src/url.lua
index e1fa2bc..243ee1c 100644
--- a/src/url.lua
+++ b/src/url.lua
@@ -110,6 +110,7 @@ local function absolute_path(base_path, relative_path)
110 if string.sub(relative_path, 1, 1) == "/" then 110 if string.sub(relative_path, 1, 1) == "/" then
111 return remove_dot_components(relative_path) end 111 return remove_dot_components(relative_path) end
112 base_path = base_path:gsub("[^/]*$", "") 112 base_path = base_path:gsub("[^/]*$", "")
113 if not base_path:find'/$' then base_path = base_path .. '/' end
113 local path = base_path .. relative_path 114 local path = base_path .. relative_path
114 path = remove_dot_components(path) 115 path = remove_dot_components(path)
115 return path 116 return path
diff --git a/test/urltest.lua b/test/urltest.lua
index 04b3c7f..b6ee299 100644
--- a/test/urltest.lua
+++ b/test/urltest.lua
@@ -690,7 +690,7 @@ check_absolute_url("http://example.com/", "...badhost.com/", "http://example.com
690check_absolute_url("http://example.com/a/b/c/d/", "../q", "http://example.com/a/b/c/q") 690check_absolute_url("http://example.com/a/b/c/d/", "../q", "http://example.com/a/b/c/q")
691check_absolute_url("http://example.com/a/b/c/d/", "../../q", "http://example.com/a/b/q") 691check_absolute_url("http://example.com/a/b/c/d/", "../../q", "http://example.com/a/b/q")
692check_absolute_url("http://example.com/a/b/c/d/", "../../../q", "http://example.com/a/q") 692check_absolute_url("http://example.com/a/b/c/d/", "../../../q", "http://example.com/a/q")
693check_absolute_url("http://example.com/a/b/c/d/", "../../../../q", "http://example.com/q") 693check_absolute_url("http://example.com", ".badhost.com", "http://example.com/.badhost.com")
694 694
695print("testing path parsing and composition") 695print("testing path parsing and composition")
696check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 }) 696check_parse_path("/eu/tu/ele", { "eu", "tu", "ele"; is_absolute = 1 })