From 5ee666ce0b65fcde396e45974795a86f1097e5bc Mon Sep 17 00:00:00 2001 From: Vladimir Kotikov Date: Tue, 3 Feb 2015 17:06:14 +0300 Subject: [PATCH] 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. --- src/windows/FileTransferProxy.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/windows/FileTransferProxy.js b/src/windows/FileTransferProxy.js index 2649282..df5dd0a 100644 --- a/src/windows/FileTransferProxy.js +++ b/src/windows/FileTransferProxy.js @@ -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) {