mirror of
https://github.com/Ferrite-iOS/Ferrite.git
synced 2026-01-11 20:10:27 +00:00
Debrid: Always use percent encoded queries
For URL encoded bodies, always send the percent encoded query since invalid parameter errors will result. Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
This commit is contained in:
parent
305cf6e6d1
commit
9d62371c08
3 changed files with 8 additions and 8 deletions
|
|
@ -283,7 +283,7 @@ class AllDebrid: PollingDebridSource, ObservableObject {
|
|||
URLQueryItem(name: "magnets[]", value: magnetLink)
|
||||
]
|
||||
|
||||
request.httpBody = bodyComponents.query?.data(using: .utf8)
|
||||
request.httpBody = bodyComponents.percentEncodedQuery?.data(using: .utf8)
|
||||
|
||||
let data = try await performRequest(request: &request, requestName: #function)
|
||||
let rawResponse = try jsonDecoder.decode(ADResponse<AddMagnetResponse>.self, from: data).data
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ class Premiumize: OAuthDebridSource, ObservableObject {
|
|||
var bodyComponents = URLComponents()
|
||||
bodyComponents.queryItems = [URLQueryItem(name: "src", value: magnet.link)]
|
||||
|
||||
request.httpBody = bodyComponents.query?.data(using: .utf8)
|
||||
request.httpBody = bodyComponents.percentEncodedQuery?.data(using: .utf8)
|
||||
|
||||
let data = try await performRequest(request: &request, requestName: #function)
|
||||
let rawResponse = try jsonDecoder.decode(DDLResponse.self, from: data)
|
||||
|
|
@ -318,7 +318,7 @@ class Premiumize: OAuthDebridSource, ObservableObject {
|
|||
var bodyComponents = URLComponents()
|
||||
bodyComponents.queryItems = [URLQueryItem(name: "src", value: magnetLink)]
|
||||
|
||||
request.httpBody = bodyComponents.query?.data(using: .utf8)
|
||||
request.httpBody = bodyComponents.percentEncodedQuery?.data(using: .utf8)
|
||||
|
||||
try await performRequest(request: &request, requestName: #function)
|
||||
}
|
||||
|
|
@ -369,7 +369,7 @@ class Premiumize: OAuthDebridSource, ObservableObject {
|
|||
var bodyComponents = URLComponents()
|
||||
bodyComponents.queryItems = [URLQueryItem(name: "id", value: downloadId)]
|
||||
|
||||
request.httpBody = bodyComponents.query?.data(using: .utf8)
|
||||
request.httpBody = bodyComponents.percentEncodedQuery?.data(using: .utf8)
|
||||
|
||||
try await performRequest(request: &request, requestName: #function)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ class RealDebrid: PollingDebridSource, ObservableObject {
|
|||
URLQueryItem(name: "grant_type", value: "http://oauth.net/grant_type/device/1.0")
|
||||
]
|
||||
|
||||
request.httpBody = bodyComponents.query?.data(using: .utf8)
|
||||
request.httpBody = bodyComponents.percentEncodedQuery?.data(using: .utf8)
|
||||
|
||||
let (data, _) = try await URLSession.shared.data(for: request)
|
||||
|
||||
|
|
@ -357,7 +357,7 @@ class RealDebrid: PollingDebridSource, ObservableObject {
|
|||
var bodyComponents = URLComponents()
|
||||
bodyComponents.queryItems = [URLQueryItem(name: "magnet", value: magnetLink)]
|
||||
|
||||
request.httpBody = bodyComponents.query?.data(using: .utf8)
|
||||
request.httpBody = bodyComponents.percentEncodedQuery?.data(using: .utf8)
|
||||
|
||||
let data = try await performRequest(request: &request, requestName: #function)
|
||||
let rawResponse = try jsonDecoder.decode(AddMagnetResponse.self, from: data)
|
||||
|
|
@ -380,7 +380,7 @@ class RealDebrid: PollingDebridSource, ObservableObject {
|
|||
bodyComponents.queryItems = [URLQueryItem(name: "files", value: joinedIds)]
|
||||
}
|
||||
|
||||
request.httpBody = bodyComponents.query?.data(using: .utf8)
|
||||
request.httpBody = bodyComponents.percentEncodedQuery?.data(using: .utf8)
|
||||
|
||||
try await performRequest(request: &request, requestName: #function)
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ class RealDebrid: PollingDebridSource, ObservableObject {
|
|||
var bodyComponents = URLComponents()
|
||||
bodyComponents.queryItems = [URLQueryItem(name: "link", value: restrictedFile.streamUrlString)]
|
||||
|
||||
request.httpBody = bodyComponents.query?.data(using: .utf8)
|
||||
request.httpBody = bodyComponents.percentEncodedQuery?.data(using: .utf8)
|
||||
|
||||
let data = try await performRequest(request: &request, requestName: #function)
|
||||
let rawResponse = try jsonDecoder.decode(UnrestrictLinkResponse.self, from: data)
|
||||
|
|
|
|||
Loading…
Reference in a new issue