Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for invalid attachment URL #676

Merged
Merged
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
Fix for invalid attachment URL
  • Loading branch information
alexbuijs committed Sep 7, 2016
commit c5d0cad75e6abcecf75e95c3739e2cb334d61e40
1 change: 1 addition & 0 deletions src/android/nl/xservices/plugins/SocialSharing.java
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public void run() {
}
} catch (Exception e) {
callbackContext.error(e.getMessage());
return;
}

// this was added to start the intent in a new window as suggested in #300 to prevent crashes upon return
Expand Down
6 changes: 6 additions & 0 deletions src/ios/SocialSharing.m
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,12 @@ - (void)shareViaEmail:(CDVInvokedUrlCommand*)command {
NSURL *file = [self getFile:path];
NSData* data = [fileManager contentsAtPath:file.path];

if (!data) {
CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"invalid attachment"];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
return;
}

NSString* fileName;
NSString* mimeType;
NSString* basename = [self getBasenameFromAttachmentPath:path];
Expand Down