mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-04-28 00:02:49 +08:00
CB-8863 fix block usage of self
This commit is contained in:
@@ -305,13 +305,14 @@ static CFIndex WriteDataToStream(NSData* data, CFWriteStreamRef stream)
|
||||
fs = [[self.commandDelegate getCommandInstance:@"File"] filesystemForURL:sourceURL];
|
||||
}
|
||||
if (fs) {
|
||||
__weak CDVFileTransfer* weakSelf = self;
|
||||
[fs readFileAtURL:sourceURL start:0 end:-1 callback:^(NSData *fileData, NSString *mimeType, CDVFileError err) {
|
||||
if (err) {
|
||||
// We couldn't find the asset. Send the appropriate error.
|
||||
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[self createFileTransferError:NOT_FOUND_ERR AndSource:source AndTarget:server]];
|
||||
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
||||
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:[weakSelf createFileTransferError:NOT_FOUND_ERR AndSource:source AndTarget:server]];
|
||||
[weakSelf.commandDelegate sendPluginResult:result callbackId:command.callbackId];
|
||||
} else {
|
||||
[self uploadData:fileData command:command];
|
||||
[weakSelf uploadData:fileData command:command];
|
||||
}
|
||||
}];
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user