Skip to content

Commit 0d8dd1c

Browse files
committed
internal-links: Open file attachments within the app.
Changing the behaviour of opening the attachments in the default browser to the app. This commit enables users to download the attachments. If the attachment type is image then we open the same in the app though users need to click on the go-back button. To-do - Open the image link in a lightbox. Improves: #469.
1 parent 0ee3757 commit 0d8dd1c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/renderer/js/components/webview.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ class WebView extends BaseComponent {
4949
const { url } = event;
5050
const domainPrefix = DomainUtil.getDomain(this.props.index).url;
5151

52-
if (LinkUtil.isInternal(domainPrefix, url) || url === (domainPrefix + '/')) {
52+
// Whitelist URLs which are allowed to be opened in the app
53+
const isWhiteListURL =
54+
LinkUtil.isInternal(domainPrefix, url) ||
55+
url === domainPrefix + '/' ||
56+
url.includes(domainPrefix + '/user_uploads/'); // URL containing the file attachments
57+
58+
if (isWhiteListURL) {
5359
event.preventDefault();
5460
this.$el.loadURL(url);
5561
} else {

0 commit comments

Comments
 (0)