Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bad conditional in key loader causing the wrong key to be loaded #2368

Merged
merged 1 commit into from
Sep 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/loader/key-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,8 @@ class KeyLoader extends EventHandler {
return;
}

// Load the key if the uri is different from previous one, or if the decrypt key has not yet been retrieved
const uri = frag.decryptdata.uri;
if (uri === this.decrypturl || this.decryptkey) {
frag.decryptdata.key = this.decryptkey;
this.hls.trigger(Event.KEY_LOADED, { frag: frag });
return;
}

// if uri is different from previous one or if decrypt key not retrieved yet
if (uri !== this.decrypturl || this.decryptkey === null) {
let config = this.hls.config;
if (loader) {
Expand Down Expand Up @@ -94,6 +88,10 @@ class KeyLoader extends EventHandler {
};

frag.loader.load(loaderContext, loaderConfig, loaderCallbacks);
} else if (this.decryptkey) {
// Return the key if it's already been loaded
frag.decryptdata.key = this.decryptkey;
this.hls.trigger(Event.KEY_LOADED, { frag: frag });
}
}

Expand Down