Merge pull request #1460 from dpalou/MOBILE-2523

MOBILE-2523 media: Fix NOT_FOUND_ERR when opening big media files
main
Juan Leyva 2018-08-22 11:29:53 +01:00 committed by GitHub
commit 0dd54379a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 18 deletions

View File

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