[vlc-devel] [PATCH] Revert "url: Remove duplicated path separators" (fixes #25374)

remi at remlab.net remi at remlab.net
Fri Feb 5 21:53:58 UTC 2021


From: RĂ©mi Denis-Courmont <remi at remlab.net>

This was just plain wrong. Multiple forward slashes does not generally
have the same meaning as a single one. This notably broke some FTP and
DLNA servers.

This reverts commit 043988a2519f557856f14578b790da66283645fc.
---
 src/test/url.c | 20 --------------------
 src/text/url.c | 21 ---------------------
 2 files changed, 41 deletions(-)

diff --git a/src/test/url.c b/src/test/url.c
index 5f31047c2d..d2b4361169 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -164,16 +164,6 @@ static void test_rfc3986(const char *reference, const char *expected)
     test(vlc_uri_resolve_rfc3986_test, reference, expected);
 }
 
-static char *vlc_uri_resolve_separators_test(const char *in)
-{
-    return vlc_uri_resolve("file:///a/b/c//d.ext", in);
-}
-
-static void test_separators(const char *reference, const char *expected)
-{
-    test(vlc_uri_resolve_separators_test, reference, expected);
-}
-
 int main (void)
 {
     (void)setvbuf (stdout, NULL, _IONBF, 0);
@@ -385,16 +375,6 @@ int main (void)
 
     for (size_t i = 0; i < ARRAY_SIZE(rfc3986_cases); i += 2)
         test_rfc3986(rfc3986_cases[i], rfc3986_cases[i + 1]);
-    static const char* separators_patterns[] = {
-        "../",                      "file:///a/b/",
-        "./",                       "file:///a/b/c/",
-        "../../../../../../../",    "file:///",
-        "..///////////////",        "file:///a/b/",
-        ".///////////////",         "file:///a/b/c/",
-        "..//..//",                 "file:///a/",
-    };
-    for (size_t i = 0; i < ARRAY_SIZE(separators_patterns); i += 2)
-        test_separators(separators_patterns[i], separators_patterns[i + 1]);
 
     /* Check that fixup does not mangle valid URIs */
     static const char *valid_uris[] =
diff --git a/src/text/url.c b/src/text/url.c
index 9e5eb6cff7..0c15a9bcb7 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -407,26 +407,6 @@ static bool vlc_uri_path_validate(const char *str)
     return vlc_uri_component_validate(str, "/@:");
 }
 
-static void vlc_uri_fixup_duplicated_separators(char *str)
-{
-    if (str == NULL)
-        return;
-    char *input = str, *output = str;
-    while (*input)
-    {
-        assert(input >= output);
-        if (*input == '/')
-        {
-            *output++ = *input;
-            while (*input == '/')
-                input++;
-        }
-        else
-            *output++ = *input++;
-    }
-    *output = 0;
-}
-
 static int vlc_UrlParseInner(vlc_url_t *restrict url, const char *str)
 {
     url->psz_protocol = NULL;
@@ -571,7 +551,6 @@ static int vlc_UrlParseInner(vlc_url_t *restrict url, const char *str)
     {
         url->psz_path = cur;
     }
-    vlc_uri_fixup_duplicated_separators(url->psz_path);
 
     return ret;
 }
-- 
2.30.0



More information about the vlc-devel mailing list