Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- SideloadedSubtitle
- Fixed an issue where subtitles failed to load after the app returned from the background, because the system had closed the connector's local server.
- Fixed an issue where the connector's local server kept running after its source was replaced or the player was destroyed.
- Fixed an issue where variant playlists failed to load when the master playlist listed them as relative URIs with a query string, because the query string was percent-encoded into the path.

## [11.0.6] - 2026-09-14

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,15 @@ class PlaylistParser {
url = URL(string: trimmedPath)
}
if let createdUrl = url,
createdUrl.scheme == nil,
let decodedPath = trimmedPath.removingPercentEncoding { // drop the percentEncoding as this will be reapplied by appendingPathComponent
return self.manifestURL.deletingLastPathComponent().appendingPathComponent(decodedPath)
createdUrl.scheme == nil {
// Resolve against the manifest URL so a query string (e.g. `?hdntl=...`) stays a query
// instead of being percent-encoded into the path by `appendingPathComponent`.
if let resolvedUrl = URL(string: trimmedPath, relativeTo: self.manifestURL)?.absoluteURL {
return resolvedUrl
}
if let decodedPath = trimmedPath.removingPercentEncoding { // drop the percentEncoding as this will be reapplied by appendingPathComponent
return self.manifestURL.deletingLastPathComponent().appendingPathComponent(decodedPath)
}
}

return url
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import Foundation
import XCTest
@testable import THEOplayerConnectorSideloadedSubtitle

final class PlaylistParserTests: XCTestCase {
private let manifestURL = URL(string: "https://cdn.example.com/vod/movie/index.m3u8?token=abc")!

func testRelativeURIKeepsQueryString() {
let parser = PlaylistParser(url: manifestURL, request: nil)

let url = parser.getFullURL(from: "video=391132.m3u8?hdntl=st=1~exp=2~acl=/*~hmac=ff")

XCTAssertEqual(url?.absoluteString, "https://cdn.example.com/vod/movie/video=391132.m3u8?hdntl=st=1~exp=2~acl=/*~hmac=ff")
}

func testRelativeURIInSubdirectoryKeepsQueryString() {
let parser = PlaylistParser(url: manifestURL, request: nil)

let url = parser.getFullURL(from: "keyframes/video.m3u8?accountId=1")

XCTAssertEqual(url?.absoluteString, "https://cdn.example.com/vod/movie/keyframes/video.m3u8?accountId=1")
}

func testRelativeURIInParentDirectoryKeepsQueryString() {
let parser = PlaylistParser(url: manifestURL, request: nil)

let url = parser.getFullURL(from: "../other/video.m3u8?accountId=1")

XCTAssertEqual(url?.absoluteString, "https://cdn.example.com/vod/other/video.m3u8?accountId=1")
}

func testRelativeURIWithoutQueryIsResolvedAgainstManifestDirectory() {
let parser = PlaylistParser(url: manifestURL, request: nil)

let url = parser.getFullURL(from: "video.m3u8")

XCTAssertEqual(url?.absoluteString, "https://cdn.example.com/vod/movie/video.m3u8")
}

func testAbsoluteURIIsNotChanged() {
let parser = PlaylistParser(url: manifestURL, request: nil)

let url = parser.getFullURL(from: "https://other.example.com/video.m3u8?token=xyz")

XCTAssertEqual(url?.absoluteString, "https://other.example.com/video.m3u8?token=xyz")
}
}
Loading