Revert "Fix pagination links not being parsed correctly for some URLs"

This reverts commit 60aa6eca36.
This commit is contained in:
Shadowfacts 2019-09-19 18:57:35 -04:00
parent f0c0376f80
commit 9502944e62
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 3 additions and 6 deletions

View File

@ -44,16 +44,13 @@ extension Pagination {
} }
let rel = segments.last?.replacingOccurrences(of: "\"", with: "").trimmingCharacters(in: .whitespaces).components(separatedBy: "=") let rel = segments.last?.replacingOccurrences(of: "\"", with: "").trimmingCharacters(in: .whitespaces).components(separatedBy: "=")
guard let urlStr = url, guard let validURL = url,
let validURL = URL(string: urlStr),
let key = rel?.first, let key = rel?.first,
key == "rel", key == "rel",
let value = rel?.last, let value = rel?.last,
let kind = Kind(rawValue: value), let kind = Kind(rawValue: value),
let components = URLComponents(url: validURL, resolvingAgainstBaseURL: false), let components = URLComponents(string: validURL),
let queryItems = components.queryItems else { let queryItems = components.queryItems else { return nil }
return nil
}
let min = queryItems.first { $0.name == "min_id" }?.value let min = queryItems.first { $0.name == "min_id" }?.value
let since = queryItems.first { $0.name == "since_id" }?.value let since = queryItems.first { $0.name == "since_id" }?.value