From 8a03ab184e622b002174e5a3eacfa8c51cedd952 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Tue, 2 Aug 2016 22:00:05 +0300 Subject: [PATCH] url: discard fragment if present If query string is absent and the fragment present, the path is followed a hash sign. We need to discard to avoid invalid path. --- src/text/url.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/text/url.c b/src/text/url.c index 88a474041d..dbe7efb751 100644 --- a/src/text/url.c +++ b/src/text/url.c @@ -400,12 +400,24 @@ void vlc_UrlParse (vlc_url_t *restrict url, const char *str) cur = next; } + /* Fragment */ + next = strchr(cur, '#'); + if (next != NULL) + { +#if 0 /* TODO */ + *(next++) = '\0'; + url->psz_fragment = next; +#else + *next = '\0'; +#endif + } + /* Query parameters */ - char *query = strchr (cur, '?'); - if (query != NULL) + next = strchr(cur, '?'); + if (next != NULL) { - *(query++) = '\0'; - url->psz_option = query; + *(next++) = '\0'; + url->psz_option = next; } /* Authority */ -- 2.11.4.GIT