Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Update TransferOperation object with new state, delete promise property
// since it is not actual anymore
var currentDownloadOp = fileTransferOps[downloadId];
if (currentDownloadOp) {
currentDownloadOp.state = FileTransferOperation.DONE;
currentDownloadOp.promise = null;
}
var nativeURI = storageFile.path.replace(appData.localFolder.path, 'ms-appdata:///local')
.replace(appData.temporaryFolder.path, 'ms-appdata:///temp')
.replace('\\', '/');
// 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) {
// Update TransferOperation object with new state, delete promise property
// since it is not actual anymore
var currentDownloadOp = fileTransferOps[downloadId];
if (currentDownloadOp) {
currentDownloadOp.state = FileTransferOperation.DONE;
currentDownloadOp.promise = null;
}
var nativeURI = storageFile.path.replace(appData.localFolder.path, 'ms-appdata:///local')
.replace(appData.temporaryFolder.path, 'ms-appdata:///temp')
.replace(/\\/g, '/');
// 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) {
storageFile.renameAsync(fileName, Windows.Storage.CreationCollisionOption.replaceExisting).done(function () {
var nativeURI = storageFile.path.replace(appData.localFolder.path, 'ms-appdata:///local')
.replace(appData.temporaryFolder.path, 'ms-appdata:///temp')
.replace(/\\/g, '/');
// 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) {
errorCallback(new FTErr(FTErr.FILE_NOT_FOUND_ERR, source, target, null, null, error));
storageFile.renameAsync(fileName, Windows.Storage.CreationCollisionOption.replaceExisting).done(function () {
var nativeURI = storageFile.path.replace(appData.localFolder.path, 'ms-appdata:///local')
.replace(appData.temporaryFolder.path, 'ms-appdata:///temp')
.replace(/\\/g, '/');
// 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) {
errorCallback(new FTErr(FTErr.FILE_NOT_FOUND_ERR, source, target, null, null, error));