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

Rémi Denis-Courmont git at videolan.org
Sun Feb 7 09:40:12 UTC 2021


vlc/vlc-3.0 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Feb  5 23:50:29 2021 +0200| [af6c9e78cf4f5595ba55976138177a4b0b4fe140] | committer: Rémi Denis-Courmont

Revert "url: Remove duplicated path separators" (fixes #25374)

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.

(cherry picked from commit 2090c051abb8d3b15fd1824c394897eedda63c7f)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=af6c9e78cf4f5595ba55976138177a4b0b4fe140
---

 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 e170d8b0ab..ab02571ac7 100644
--- a/src/test/url.c
+++ b/src/test/url.c
@@ -158,16 +158,6 @@ static void test_fixup_noop(const char *expected)
     test(vlc_uri_fixup, expected, 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);
@@ -373,16 +363,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 c3c36015d7..83bba30e09 100644
--- a/src/text/url.c
+++ b/src/text/url.c
@@ -401,26 +401,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;
@@ -568,7 +548,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;
 }



More information about the vlc-commits mailing list