From 18f8137798ccf99c1f275fd1f6e2247e1e3e45ed Mon Sep 17 00:00:00 2001 From: Thomas Holder Date: Mon, 5 Nov 2018 22:12:05 +0100 Subject: Replacement for xmlBuildRelativeURI - xmlBuildRelativeURI has a bug - we add a special case: Don't cross filesystem root --- testfiles/src/uri-test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'testfiles') diff --git a/testfiles/src/uri-test.cpp b/testfiles/src/uri-test.cpp index 6f0787af5..c10012d49 100644 --- a/testfiles/src/uri-test.cpp +++ b/testfiles/src/uri-test.cpp @@ -53,6 +53,15 @@ TEST(UriTest, Str) ASSERT_EQ(URI("foo/uri.svg", "http://web/a/b/c").str("http://web/a/"), "b/foo/uri.svg"); ASSERT_EQ(URI("foo/uri.svg", "http://web/a/b/c").str("http://other/a/"), "http://web/a/b/foo/uri.svg"); + ASSERT_EQ(URI("http://web/").str("http://web/"), ""); + ASSERT_EQ(URI("http://web/").str("http://web/url"), "./"); + + // special case: don't cross filesystem root + ASSERT_EQ(URI("file:///a").str("file:///"), "a"); + ASSERT_EQ(URI("file:///ax/b").str("file:///ay/"), "file:///ax/b"); // special case + ASSERT_EQ(URI("file:///C:/b").str("file:///D:/"), "file:///C:/b"); // special case + ASSERT_EQ(URI("file:///C:/a/b").str("file:///C:/b/"), "../a/b"); + const char *win_url_unc = "file://laptop/My%20Documents/FileSchemeURIs.doc"; const char *win_url_local = "file:///C:/Documents%20and%20Settings/davris/FileSchemeURIs.doc"; -- cgit v1.2.3