diff options
author | wm4 <wm4@nowhere> | 2019-12-20 08:35:08 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-12-20 08:35:08 +0100 |
commit | 572c32abbedd3860718f099743dfa973b4f58bbc (patch) | |
tree | c139a65e3105a98856e2bebef4d00e22b7602e47 | |
parent | 505cab9c1509d7561de7354e6a26e33dc3869e3b (diff) | |
download | mpv-572c32abbedd3860718f099743dfa973b4f58bbc.tar.bz2 mpv-572c32abbedd3860718f099743dfa973b4f58bbc.tar.xz |
libarchive: prefix entry names in archive URLs with '/'
This has the advantage that playlists within the archive will work as
expected, because demux_playlist will correctly join the archive base
URL and entry name. Before this change, it could skip before the "|",
resulting in a broken URL.
-rw-r--r-- | demux/demux_libarchive.c | 2 | ||||
-rw-r--r-- | stream/stream_libarchive.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/demux/demux_libarchive.c b/demux/demux_libarchive.c index bb2ca24862..80bd3e240e 100644 --- a/demux/demux_libarchive.c +++ b/demux/demux_libarchive.c @@ -74,7 +74,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check) while (mp_archive_next_entry(mpa)) { // stream_libarchive.c does the real work - char *f = talloc_asprintf(mpa, "archive://%s|%s", prefix, + char *f = talloc_asprintf(mpa, "archive://%s|/%s", prefix, mpa->entry_filename); MP_TARRAY_APPEND(mpa, files, num_files, f); } diff --git a/stream/stream_libarchive.c b/stream/stream_libarchive.c index e3109dfb0a..2e300f3747 100644 --- a/stream/stream_libarchive.c +++ b/stream/stream_libarchive.c @@ -485,7 +485,9 @@ static int archive_entry_open(stream_t *stream) char *base = talloc_strdup(p, stream->path); char *name = strchr(base, '|'); *name++ = '\0'; - p->entry_name = name; + if (name[0] != '/') + return STREAM_ERROR; + p->entry_name = name + 1; mp_url_unescape_inplace(base); p->src = stream_create(base, STREAM_READ | STREAM_SAFE_ONLY, |