From bdf3ec6fa769e16ddcc84b5b764e515b778eb7ec Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 4 Jan 2019 08:19:53 +0100 Subject: [PATCH] MOBILE-2795 file: Allow opening local attachments --- src/components/file/file.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/components/file/file.ts b/src/components/file/file.ts index f79be7811..53fb53aa6 100644 --- a/src/components/file/file.ts +++ b/src/components/file/file.ts @@ -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);