Properly encoded the url query part. This broke some time ago.
This commit is contained in:
1 parent
8faafc861e
commit
0723ebdf2e
1 file changed
+7
-1
@@ -9,10 +9,16 @@ import Foundation
|
|||||||
|
|
||||||
// MARK: - URL Utilities
|
// MARK: - URL Utilities
|
||||||
|
|
||||||
|
private let allowedChars: CharacterSet = {
|
||||||
|
var chars = CharacterSet.urlQueryAllowed
|
||||||
|
chars.remove(charactersIn: "&+=?")
|
||||||
|
return chars
|
||||||
|
}()
|
||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
|
|
||||||
func urlEncoded() -> String {
|
func urlEncoded() -> String {
|
||||||
return self.precomposedStringWithCompatibilityMapping.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) ?? ""
|
return self.precomposedStringWithCompatibilityMapping.addingPercentEncoding(withAllowedCharacters: allowedChars) ?? ""
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user