Skip to content
Snippets Groups Projects
Commit db2d7fbe authored by Spotlight's avatar Spotlight
Browse files

Fix UTI recognition

parent 6769631a
No related branches found
No related tags found
No related merge requests found
......@@ -86,13 +86,8 @@ class GCPAuthHandler {
print(path)
let fileURL = URL(fileURLWithPath: path)
// Use UTIKit to grab the first MIME type recorded.
let potentialMimeTypes = UTI(fileURL.pathExtension).mimeTypes
var mimeType : String
if (potentialMimeTypes == []) {
mimeType = "application/octet-stream"
} else {
mimeType = potentialMimeTypes[0]
}
let mimeType = UTI(filenameExtension: fileURL.pathExtension)?.mimeType ?? "application/octet-stream"
print(mimeType)
let uploadParameters = GTLRUploadParameters.init(fileURL: fileURL, mimeType: mimeType)
let newObject = GTLRStorage_Object()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment