Skip to content

Commit

Permalink
Do not encode invalid characters
Browse files Browse the repository at this point in the history
  • Loading branch information
SvenTiigi committed Apr 11, 2024
1 parent d000d64 commit 5ade0df
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Sources/Models/YouTubePlayer+Source.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,21 @@ public extension YouTubePlayer.Source {
_ urlString: String
) -> Self? {
// Initialize URL from string and call URL-based convenience method
guard let url = URL(string: urlString) else {
guard let url: URL = {
if #available(iOS 17.0, tvOS 17.0, watchOS 10.0, macOS 14.0, *) {
return .init(
string: urlString,
encodingInvalidCharacters: false
)
} else {
return .init(
string: urlString
)
}
}() else {
return nil
}
return Self.url(url)
return self.url(url)
}

/// Creats `YouTubePlayer.Source` from a given URL, if available
Expand Down

0 comments on commit 5ade0df

Please sign in to comment.