MOBILE-2523 media: Fix NOT_FOUND_ERR when opening big media files

main
Dani Palou 2018-08-07 12:07:00 +02:00
parent e6c5607463
commit 7924dadcfb
1 changed files with 22 additions and 18 deletions

View File

@ -62,13 +62,16 @@ export class CoreFileHelperProvider {
return Promise.reject(error);
}
let promise;
// Get the state.
if (state) {
return state;
promise = Promise.resolve(state);
} else {
return this.filepoolProvider.getFileStateByUrl(siteId, fileUrl, timemodified);
promise = this.filepoolProvider.getFileStateByUrl(siteId, fileUrl, timemodified);
}
}).then((state) => {
return promise.then((state) => {
if (state == CoreConstants.DOWNLOADING) {
return Promise.reject(this.translate.instant('core.erroropenfiledownloading'));
}
@ -87,6 +90,7 @@ export class CoreFileHelperProvider {
return this.utils.openFile(url);
});
});
});
} else {
return this.utils.openFile(url);
}