CB-8407 Use File proxy to construct valid FileEntry for download success callback

Due to changes in file plugin (https://github.com/apache/cordova-plugin-file/commit/bcbeae24cd24583b790da95e0e076492eb16cd4f) result of download method should now have filesystemName specified for proper work. This updates download method to construct FileEntry properly, using File plugin proxy.
This commit is contained in:
Vladimir Kotikov
2015-02-11 17:46:03 -08:00
committed by Jesse MacFadyen
parent 28189e54f3
commit 5ee666ce0b
+4 -1
View File
@@ -26,6 +26,7 @@
var FTErr = require('./FileTransferError'),
ProgressEvent = require('org.apache.cordova.file.ProgressEvent'),
FileUploadResult = require('org.apache.cordova.file.FileUploadResult'),
FileProxy = require('org.apache.cordova.file.FileProxy'),
FileEntry = require('org.apache.cordova.file.FileEntry');
var appData = Windows.Storage.ApplicationData.current;
@@ -313,7 +314,9 @@ exec(win, fail, 'FileTransfer', 'upload',
.replace(appData.temporaryFolder.path, 'ms-appdata:///temp')
.replace('\\', '/');
successCallback(new FileEntry(storageFile.name, storageFile.path, null, nativeURI));
// Passing null as error callback here because downloaded file should exist in any case
// otherwise the error callback will be hit during file creation in another place
FileProxy.resolveLocalFileSystemURI(successCallback, null, [nativeURI]);
}, function(error) {
var getTransferError = new WinJS.Promise(function (resolve) {