Pachyderm: Fix request bodies form parameters not being percent-escaped

Fixes #65
This commit is contained in:
Shadowfacts 2019-12-18 21:59:08 -05:00
parent afc2bfcf6b
commit 6831ab5385
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 5 additions and 2 deletions

View File

@ -67,8 +67,11 @@ extension Parameter: CustomStringConvertible {
extension Array where Element == Parameter {
var urlEncoded: String {
return compactMap {
guard let value = $0.value else { return nil }
return "\($0.name)=\(value)"
guard let value = $0.value,
let escapedValue = value.addingPercentEncoding(withAllowedCharacters: .alphanumerics) else {
return nil
}
return "\($0.name)=\(escapedValue)"
}.joined(separator: "&")
}