Properly handle subrequests for redirected URLs

This commit is contained in:
Vanilagy
2026-06-16 14:53:27 +02:00
parent b4a6757739
commit 2f0c040fcd
3 changed files with 32 additions and 9 deletions
+4 -1
View File
@@ -77,12 +77,15 @@ export class HlsDemuxer extends Demuxer {
readMetadata() {
return this.metadataPromise ??= (async () => {
assert(this.input._rootSource instanceof PathedSource);
const { rootPath } = this.input._rootSource;
const slice = await this.input._reader.requestEntireFile();
assert(slice);
const lines = readAllLines(slice, slice.length, { ignore: canIgnoreLine });
// Important: get the root path AFTER reading data to get the final root path, possibly affected by
// redirects. Any follow requests should be related to the redirected path, not the original one.
const { rootPath } = this.input._rootSource;
const variantStreams: {
fullPath: string;
attributes: AttributeList;