Skip to content
Open
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
11 changes: 7 additions & 4 deletions src/ios/CDVFileTransfer.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Licensed to the Apache Software Foundation (ASF) under one
#import <Cordova/CDV.h>
#import "CDVFileTransfer.h"
#import "CDVLocalFilesystem.h"
#import "CDVFile.h"

#import <AssetsLibrary/ALAsset.h>
#import <AssetsLibrary/ALAssetRepresentation.h>
Expand Down Expand Up @@ -289,7 +290,7 @@ - (CDVFileTransferDelegate*)delegateForUploadCommand:(CDVInvokedUrlCommand*)comm
delegate.source = source;
delegate.target = server;
delegate.trustAllHosts = trustAllHosts;
delegate.filePlugin = [self.commandDelegate getCommandInstance:@"File"];
delegate.filePlugin = (CDVFile *)[self.commandDelegate getCommandInstance:@"File"];
delegate.chunkedMode = chunkedMode;

return delegate;
Expand Down Expand Up @@ -328,7 +329,8 @@ - (void)fileDataForUploadCommand:(CDVInvokedUrlCommand*)command
if (sourceURL) {
// Try to get a CDVFileSystem which will handle this file.
// This requires talking to the current CDVFile plugin.
fs = [[self.commandDelegate getCommandInstance:@"File"] filesystemForURL:sourceURL];
CDVFile *filePlugin = (CDVFile *)[self.commandDelegate getCommandInstance:@"File"];
fs = [filePlugin filesystemForURL:sourceURL];
}
if (fs) {
__weak CDVFileTransfer* weakSelf = self;
Expand Down Expand Up @@ -430,7 +432,8 @@ - (void)download:(CDVInvokedUrlCommand*)command
* Check here to see if it looks like the user passed in a raw filesystem path. (Perhaps they had the path saved, and were previously using it with the old version of File). If so, normalize it by removing empty path segments, and check with File to see if any of the installed filesystems will handle it. If so, then we will end up with a filesystem url to use for the remainder of this operation.
*/
target = [target stringByReplacingOccurrencesOfString:@"//" withString:@"/"];
targetURL = [[self.commandDelegate getCommandInstance:@"File"] fileSystemURLforLocalPath:target].url;
CDVFile *filePlugin = (CDVFile *)[self.commandDelegate getCommandInstance:@"File"];
targetURL = [filePlugin fileSystemURLforLocalPath:target].url;
} else {
targetURL = [NSURL URLWithString:target];

Expand Down Expand Up @@ -476,7 +479,7 @@ - (void)download:(CDVInvokedUrlCommand*)command
delegate.target = [targetURL absoluteString];
delegate.targetURL = targetURL;
delegate.trustAllHosts = trustAllHosts;
delegate.filePlugin = [self.commandDelegate getCommandInstance:@"File"];
delegate.filePlugin = (CDVFile *)[self.commandDelegate getCommandInstance:@"File"];
delegate.backgroundTaskID = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[delegate cancelTransfer:delegate.connection];
}];
Expand Down
Loading