From 944c79ec6129c4c88976fe1d8b1099a6ebdf0a8f Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Mon, 8 Oct 2018 16:04:16 +0200 Subject: [PATCH 1/3] disable hyperlink for attachments --- extra_scripts/codemirror/addon/hyperlink/hyperlink.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extra_scripts/codemirror/addon/hyperlink/hyperlink.js b/extra_scripts/codemirror/addon/hyperlink/hyperlink.js index 3f548c51c..6a81c1735 100755 --- a/extra_scripts/codemirror/addon/hyperlink/hyperlink.js +++ b/extra_scripts/codemirror/addon/hyperlink/hyperlink.js @@ -52,7 +52,8 @@ if (className.indexOf('cm-url') !== -1) { const match = /^\((.*)\)|\[(.*)\]|(.*)$/.exec(el.textContent) - return match[1] || match[2] || match[3] + const url = match[1] || match[2] || match[3] + return /^:storage\//.test(url) ? null : url } return null From 33f69269166d5ea3afd2af0d7c3a16c5121e042d Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Tue, 9 Oct 2018 09:35:10 +0200 Subject: [PATCH 2/3] fix regex for windows' url --- extra_scripts/codemirror/addon/hyperlink/hyperlink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra_scripts/codemirror/addon/hyperlink/hyperlink.js b/extra_scripts/codemirror/addon/hyperlink/hyperlink.js index 6a81c1735..ca9ed8fa7 100755 --- a/extra_scripts/codemirror/addon/hyperlink/hyperlink.js +++ b/extra_scripts/codemirror/addon/hyperlink/hyperlink.js @@ -53,7 +53,7 @@ if (className.indexOf('cm-url') !== -1) { const match = /^\((.*)\)|\[(.*)\]|(.*)$/.exec(el.textContent) const url = match[1] || match[2] || match[3] - return /^:storage\//.test(url) ? null : url + return /^:storage(?:\/|%5C)/.test(url) ? null : url } return null From 1922c8dbf8cc0ab83dce570c4287dbe94aeec704 Mon Sep 17 00:00:00 2001 From: Baptiste Augrain Date: Tue, 9 Oct 2018 10:15:30 +0200 Subject: [PATCH 3/3] add comment to the STORAGE_FOLDER_PLACEHOLDER variable --- extra_scripts/codemirror/addon/hyperlink/hyperlink.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extra_scripts/codemirror/addon/hyperlink/hyperlink.js b/extra_scripts/codemirror/addon/hyperlink/hyperlink.js index ca9ed8fa7..4740bd21e 100755 --- a/extra_scripts/codemirror/addon/hyperlink/hyperlink.js +++ b/extra_scripts/codemirror/addon/hyperlink/hyperlink.js @@ -53,6 +53,8 @@ if (className.indexOf('cm-url') !== -1) { const match = /^\((.*)\)|\[(.*)\]|(.*)$/.exec(el.textContent) const url = match[1] || match[2] || match[3] + + // `:storage` is the value of the variable `STORAGE_FOLDER_PLACEHOLDER` defined in `browser/main/lib/dataApi/attachmentManagement` return /^:storage(?:\/|%5C)/.test(url) ? null : url }