[BUG] [swift5] mapFileBinaryToData crashes fatally in URLSessionImplementations.swift
Created by: denizdogan
In URLSessionImplementations.swift, there's a case missing in the switch:
case let number as NSNumber:
if let data = number.stringValue.data(using: .utf8) {
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
}
case let data as Data: // <--- this entire case is missing!
urlRequest = configureDataUploadRequest(
urlRequest: urlRequest,
boundary: boundary,
name: key,
data: data
)
default:
fatalError("Unprocessable value \(value) with key \(key)")
}
The above works for me, I'm not sure there's anything I'm missing here. Without the above case for Data
, the entire application crashes fatally. It only happens when used with mapFileBinaryToData: true
.
@4brunu