Skip to content

Commit

Permalink
[TIMOB-20072] Fix unhandled mime type in gallery
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Nov 30, 2015
1 parent 65268c6 commit 3258a9c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions iphone/Classes/MediaModule.m
Expand Up @@ -820,6 +820,18 @@ -(void)saveToPhotoGallery:(id)arg
}
UISaveVideoAtPathToSavedPhotosAlbum(filePath, self, @selector(saveCompletedForVideo:error:contextInfo:), [saveCallbacks retain]);
}
else
{
KrollCallback* errorCallback = [saveCallbacks valueForKey:@"error"];
if (errorCallback != nil) {
NSMutableDictionary * event = [TiUtils dictionaryWithCode:-1 message:[NSString stringWithFormat:@"Invalid mime type: Expected either image/* or video/*, was: %@",mime]];
[self dispatchCallback:[NSArray arrayWithObjects:@"error",event,errorCallback,nil]];
} else {
[self throwException:@"Invalid mime type"
subreason:[NSString stringWithFormat:@"Invalid mime type: Expected either image/* or video/*, was: %@",mime]
location:CODELOCATION];
}
}
}
else if ([image isKindOfClass:[TiFile class]])
{
Expand All @@ -840,11 +852,11 @@ -(void)saveToPhotoGallery:(id)arg
{
KrollCallback* errorCallback = [saveCallbacks valueForKey:@"error"];
if (errorCallback != nil) {
NSMutableDictionary * event = [TiUtils dictionaryWithCode:-1 message:[NSString stringWithFormat:@"invalid media type: Exepcted either TiBlob or TiFile, was: %@",JavascriptNameForClass([image class])]];
NSMutableDictionary * event = [TiUtils dictionaryWithCode:-1 message:[NSString stringWithFormat:@"Invalid media type: Expected either TiBlob or TiFile, was: %@",JavascriptNameForClass([image class])]];
[self dispatchCallback:[NSArray arrayWithObjects:@"error",event,errorCallback,nil]];
} else {
[self throwException:@"invalid media type"
subreason:[NSString stringWithFormat:@"expected either TiBlob or TiFile, was: %@",JavascriptNameForClass([image class])]
[self throwException:@"Invalid media type"
subreason:[NSString stringWithFormat:@"Expected either TiBlob or TiFile, was: %@",JavascriptNameForClass([image class])]
location:CODELOCATION];
}
}
Expand Down

0 comments on commit 3258a9c

Please sign in to comment.