diff --git a/kordophone/Bridge/Operations/MBIMFetchAttachmentOperation.m b/kordophone/Bridge/Operations/MBIMFetchAttachmentOperation.m index 114afd0..b7cc8b7 100644 --- a/kordophone/Bridge/Operations/MBIMFetchAttachmentOperation.m +++ b/kordophone/Bridge/Operations/MBIMFetchAttachmentOperation.m @@ -54,6 +54,13 @@ } NSString *mimeType = [transfer mimeType]; + // It's unusual, but if this is nil, try to guess the MIME type based on the filename + if (!mimeType) { + NSString *extension = [[localPath pathExtension] lowercaseString]; + + // XXX: REALLY hacky + mimeType = [NSString stringWithFormat:@"image/%@", extension]; + } response = [[MBIMDataResponse alloc] initWithData:responseData contentType:mimeType]; } while (0); diff --git a/kordophone/Bridge/Operations/Utilities/MBIMDataResponse.m b/kordophone/Bridge/Operations/Utilities/MBIMDataResponse.m index e6ea79d..8758de0 100644 --- a/kordophone/Bridge/Operations/Utilities/MBIMDataResponse.m +++ b/kordophone/Bridge/Operations/Utilities/MBIMDataResponse.m @@ -25,7 +25,7 @@ - (NSDictionary *)httpHeaders { return @{ - @"Content-Type" : _contentType + @"Content-Type" : _contentType ?: @"application/octet-stream" }; }