Add exception handling for externalURL

This commit is contained in:
PangMo5 2022-07-05 16:56:30 +09:00
parent 9508c5f113
commit bae144c2bd
1 changed files with 4 additions and 0 deletions

View File

@ -11,6 +11,10 @@ import JellyfinAPI
extension MediaStream {
func externalURL(base: String) -> URL? {
var base = base
while base.last == Character("/") {
base.removeLast()
}
guard let deliveryURL = deliveryUrl else { return nil }
return URL(string: base + deliveryURL)
}