You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File is successfully downloading but getting an error in the success callback
Problem
[{"isFile":false,"isDirectory":true,"name":"","fullPath":"/","filesystem":"<FileSystem: library-nosync>","nativeURL":"file:///var/mobile/Containers/Data/Application/900BE112-444C-4F33-84AF-F745E8EE0C91/Library/NoCloud/"}]
[{"isFile":false,"isDirectory":true,"name":"download","fullPath":"/download/","filesystem":"<FileSystem: library-nosync>","nativeURL":"file:///var/mobile/Containers/Data/Application/900BE112-444C-4F33-84AF-F745E8EE0C91/Library/NoCloud/download/"}]
console log path test: file:/var/mobile/Containers/Data/Application/900BE112-444C-4F33-84AF-F745E8EE0C91/Library/NoCloud/download/Word1.DOC
File Transfer downloading file...
[CDVFileTransferDelegate connection:didReceiveResponse:] [Line 771] Streaming to file /var/mobile/Containers/Data/Application/900BE112-444C-4F33-84AF-F745E8EE0C91/Library/NoCloud/download/Word1.DOC
File Transfer Finished with response code 200
[CDVFileTransferDelegate connectionDidFinishLoading:] [Line 637] File Transfer Download success
Error in Success callbackId: FileTransfer1502202275 : TypeError: null is not an object (evaluating 'result.lengthComputable')
win@ionic://myApp/plugins/cordova-plugin-file-transfer/www/FileTransfer.js:202:26
callbackFromNative@ionic://attendago/cordova.js:295:63
ionic://myApp/plugins/cordova-plugin-ionic-webview/src/www/ios/ios-wkwebview-exec.js:129:35
promiseReactionJob@[native code]
What is expected to happen?
Its supposed to cleanly download the file.
What does actually happen?
The above error is thrown, the file can't be found anywhere in iOS folders and the app page breaks because the JS error was thrown.
Command or Code
Here is the code I am using to download the file. It all works just fine on Android, but not on iOS. I am using the codorva-plugin-file-downloader plugin which is a wrapper that uses this plugin. The error being thrown is from this plugin.
$scope.downloadLink = function(fileInfo) {
if (fileInfo.cType == 2) {
var dir = "images" ;
} else {
var dir = "docs" ;
}
var urlFile = "https://portal.attendago.com/files/C" +fileInfo.cID+ "/" +dir+ "/" + fileInfo.cfInfo ;
var newFileName = fileInfo.cfName+ "." +fileInfo.cfExt ;
let storage_location = '' ;
if (ionic.Platform.isIOS()) {
//storage_location = cordova.file.documentsDirectory ;
storage_location = cordova.file.dataDirectory ;
} else if (ionic.Platform.isAndroid()) {
storage_location = 'file:///storage/emulated/0/' ;
}
let downloading = function(event) {
var data = event.data ;
if (data[0] != 100) {
var msg = "Downloading file: " +data[0]+ "%" ;
var color = "red" ;
} else {
var msg = "DOWNLOAD COMPLETE!" ;
var color = "green" ;
}
$scope.startStatus(fileInfo.cfID,color,msg) ;
}
let downloaded = function(event) {
setTimeout(function() {
$scope.endStatus(fileInfo.cfID) ;
event.target.removeEventListener(event.name,downloaded) ;
},5000) ;
}
let initialized = function(event) {
downloader.get(urlFile,null,newFileName) ;
event.target.removeEventListener(event.name,initialized) ;
} ;
document.addEventListener('DOWNLOADER_initialized', initialized) ;
document.addEventListener('DOWNLOADER_downloadProgress',downloading) ;
document.addEventListener('DOWNLOADER_downloadSuccess', downloaded) ;
document.addEventListener('DOWNLOADER_gotFileSystem', function() {
console.log(event.data) ;
}) ;
document.addEventListener('DOWNLOADER_gotFolder', function() {
console.log(event.data) ;
}) ;
downloader.init({folder: 'download', fileSystem: storage_location})
}
Bug Report
File is successfully downloading but getting an error in the success callback
Problem
What is expected to happen?
Its supposed to cleanly download the file.
What does actually happen?
The above error is thrown, the file can't be found anywhere in iOS folders and the app page breaks because the JS error was thrown.
Command or Code
Here is the code I am using to download the file. It all works just fine on Android, but not on iOS. I am using the
codorva-plugin-file-downloader
plugin which is a wrapper that uses this plugin. The error being thrown is from this plugin.Environment, Platform, Device
iPhone 7, iOS 14.1
Version information
Checklist
The text was updated successfully, but these errors were encountered: