Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Source/SwiftyDropbox/Shared/Handwritten/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ public class Request<RSerial: JSONSerializer, ESerial: JSONSerializer> {

func handleResponseError(networkTaskFailure: NetworkTaskFailure) -> CallError<ESerial.ValueType> {
let callError = parseCallError(from: networkTaskFailure)

// We call the global error response handler to alert it to an error
// But unlike in the objc SDK we do not stop the SDK from calling the per-route completion handler as well.
GlobalErrorResponseHandler.shared.reportGlobalError(callError.typeErased)

return callError
}

private func parseCallError(from networkTaskFailure: NetworkTaskFailure) -> CallError<ESerial.ValueType> {
switch networkTaskFailure {
case .badStatusCode(let data, _, let response):
Expand Down Expand Up @@ -292,7 +292,7 @@ public class DownloadRequestMemory<RSerial: JSONSerializer, ESerial: JSONSeriali

private func caseInsensitiveLookup(_ lookupKey: String, dictionary: [AnyHashable: Any]) -> String? {
for key in dictionary.keys {
let keyString = key as! String
guard let keyString = key as? String else { continue }
if keyString.lowercased() == lookupKey.lowercased() {
return dictionary[key] as? String
}
Expand Down
2 changes: 1 addition & 1 deletion Source/SwiftyDropbox/Shared/Handwritten/Utilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Foundation

enum Utilities {
static func utf8Decode(_ data: Data) -> String {
NSString(data: data, encoding: String.Encoding.utf8.rawValue)! as String
String(data: data, encoding: .utf8) ?? String(data: data, encoding: .ascii) ?? ""
}

static func asciiEscape(_ s: String) -> String {
Expand Down
Loading