MOBILE-2795 file: Allow opening local attachments

main
Dani Palou 2019-01-04 08:19:53 +01:00
parent 2a439224f2
commit bdf3ec6fa7
1 changed files with 16 additions and 0 deletions

View File

@ -152,6 +152,22 @@ export class CoreFileComponent implements OnInit, OnDestroy {
return;
}
if (!this.canDownload) {
// File cannot be downloaded, just open it.
if (this.file.toURL) {
// Local file.
this.utils.openFile(this.file.toURL());
} else if (this.fileUrl) {
if (this.fileUrl.indexOf('http') === 0) {
this.utils.openOnlineFile(this.fileUrl);
} else {
this.utils.openFile(this.fileUrl);
}
}
return;
}
if (!this.appProvider.isOnline() && (!openAfterDownload || (openAfterDownload && !this.isDownloaded))) {
this.domUtils.showErrorModal('core.networkerrormsg', true);