summaryrefslogtreecommitdiff
path: root/ext/hls/m3u8.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/hls/m3u8.c')
-rw-r--r--ext/hls/m3u8.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ext/hls/m3u8.c b/ext/hls/m3u8.c
index a5903b89a..91d00bcb6 100644
--- a/ext/hls/m3u8.c
+++ b/ext/hls/m3u8.c
@@ -795,7 +795,15 @@ uri_join (const gchar * uri1, const gchar * uri2)
uri_copy = g_strdup (uri1);
if (uri2[0] != '/') {
/* uri2 is a relative uri2 */
- tmp = g_utf8_strrchr (uri_copy, -1, '/');
+ /* look for query params */
+ tmp = g_utf8_strchr (uri_copy, -1, '?');
+ if (tmp) {
+ /* find last / char, ignoring query params */
+ tmp = g_utf8_strrchr (uri_copy, tmp - uri_copy, '/');
+ } else {
+ /* find last / char in URL */
+ tmp = g_utf8_strrchr (uri_copy, -1, '/');
+ }
if (!tmp) {
GST_WARNING ("Can't build a valid uri_copy");
goto out;