diff --git a/src/ios/CordovaHttpPlugin.m b/src/ios/CordovaHttpPlugin.m index d938047..5630d2b 100644 --- a/src/ios/CordovaHttpPlugin.m +++ b/src/ios/CordovaHttpPlugin.m @@ -177,6 +177,10 @@ [self setRequestHeaders: headers]; + if ([filePath hasPrefix:@"file://"]) { + filePath = [filePath substringFromIndex:7]; + } + CordovaHttpPlugin* __weak weakSelf = self; manager.responseSerializer = [AFHTTPResponseSerializer serializer]; [manager GET:url parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { @@ -229,10 +233,10 @@ return; } - CDVFile *file = [[CDVFile alloc] init]; + id filePlugin = [self.commandDelegate getCommandInstance:@"File"]; NSMutableDictionary *dictionary = [NSMutableDictionary dictionary]; [dictionary setObject:[NSNumber numberWithInt:operation.response.statusCode] forKey:@"status"]; - [dictionary setObject:[file getDirectoryEntry:filePath isDirectory:NO] forKey:@"file"]; + [dictionary setObject:[filePlugin getDirectoryEntry:filePath isDirectory:NO] forKey:@"file"]; CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary]; [weakSelf.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; } failure:^(AFHTTPRequestOperation *operation, NSError *error) {