Skip to content

Commit

Permalink
url: discard fragment if present
Browse files Browse the repository at this point in the history
If query string is absent and the fragment present, the path is
followed a hash sign. We need to discard to avoid invalid path.
  • Loading branch information
Rémi Denis-Courmont committed Aug 2, 2016
1 parent b371cd2 commit 8a03ab1
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/text/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 8a03ab1

Please sign in to comment.