Skip to content

Commit

Permalink
fix: don't double wrap URIs for HLS key requests (#6246)
Browse files Browse the repository at this point in the history
The `constructSegmentUris` util already returns an array, so the call to `makeRequest` was being made with an array of arrays. This wasn't causing errors for requests that use the `fetch` plugin, since `fetch` will stringify the first argument if it's an array. But the data URI plugin expects to receive a string and calls `.split()` on it, so keys using data URIs throw an error if the URI is wrapped in an array.

Thanks to #6243 and @andrew0

Backported to v4.7.x
  • Loading branch information
avelad authored and joeyparrish committed Feb 20, 2024
1 parent 4a4c9e9 commit 0e37f4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/hls/hls_parser.js
Expand Up @@ -2831,12 +2831,12 @@ shaka.hls.HlsParser = class {
// Don't download the key object until the segment is parsed, to avoid a
// startup delay for long manifests with lots of keys.
keyInfo.fetchKey = async () => {
const keyUri = shaka.hls.Utils.constructSegmentUris(
const keyUris = shaka.hls.Utils.constructSegmentUris(
getUris(), drmTag.getRequiredAttrValue('URI'), variables);

const requestType = shaka.net.NetworkingEngine.RequestType.KEY;
const request = shaka.net.NetworkingEngine.makeRequest(
[keyUri], this.config_.retryParameters);
keyUris, this.config_.retryParameters);
const keyResponse = await this.makeNetworkRequest_(request, requestType);

// keyResponse.status is undefined when URI is "data:text/plain;base64,"
Expand Down

0 comments on commit 0e37f4a

Please sign in to comment.