mirror of
https://github.com/dirtydishes/dreamio.git
synced 2026-06-06 13:37:24 +00:00
fix url redaction crash
This commit is contained in:
parent
d46004a98e
commit
6e220e6df9
4 changed files with 12 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ struct StreamResolverTests {
|
|||
testClassifierPrefersObservedDirectFile()
|
||||
testResolverSelectsUnsupportedDirectURLAndHeaders()
|
||||
testResolverRejectsHLSOnlyResponse()
|
||||
testRedactorHandlesPercentEncodedPath()
|
||||
print("StreamResolverTests passed")
|
||||
}
|
||||
|
||||
|
|
@ -67,6 +68,13 @@ struct StreamResolverTests {
|
|||
assert(stream == nil, "Expected HLS-only resolver response to stay out of native playback")
|
||||
}
|
||||
|
||||
private static func testRedactorHandlesPercentEncodedPath() {
|
||||
let original = "https://cdn.example.test/video/abcdefghijklmnopqrstuvwxyz012345/%E2%9C%93.mp4?token=secret#fragment"
|
||||
let redacted = URLRedactor.redactedURLString(original)
|
||||
|
||||
assertEqual(redacted, "https://cdn.example.test/video/%5Bredacted%5D/%E2%9C%93.mp4")
|
||||
}
|
||||
|
||||
private static func assertEqual<T: Equatable>(_ actual: T?, _ expected: T, file: StaticString = #file, line: UInt = #line) {
|
||||
assert(actual == expected, "Expected \(String(describing: expected)), got \(String(describing: actual))", file: file, line: line)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue