Skip to content

Commit 5ade0df

Browse files
committed
Do not encode invalid characters
1 parent d000d64 commit 5ade0df

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Sources/Models/YouTubePlayer+Source.swift

+13-2
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,21 @@ public extension YouTubePlayer.Source {
8888
_ urlString: String
8989
) -> Self? {
9090
// Initialize URL from string and call URL-based convenience method
91-
guard let url = URL(string: urlString) else {
91+
guard let url: URL = {
92+
if #available(iOS 17.0, tvOS 17.0, watchOS 10.0, macOS 14.0, *) {
93+
return .init(
94+
string: urlString,
95+
encodingInvalidCharacters: false
96+
)
97+
} else {
98+
return .init(
99+
string: urlString
100+
)
101+
}
102+
}() else {
92103
return nil
93104
}
94-
return Self.url(url)
105+
return self.url(url)
95106
}
96107

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

0 commit comments

Comments
 (0)