diff options
author | Max <max@nextcloud.com> | 2024-12-19 09:54:21 +0100 |
---|---|---|
committer | Max <max@nextcloud.com> | 2024-12-19 09:54:21 +0100 |
commit | 13189d799081e8a953cc33ccd8f9ae246893f9dc (patch) | |
tree | 112ec3cb44a1359244718c06e8fab05ae72fe71a | |
parent | 7e57d0df2b8702ceb09f6310157e681482ac7090 (diff) | |
download | nextcloud-server-13189d799081e8a953cc33ccd8f9ae246893f9dc.tar.gz nextcloud-server-13189d799081e8a953cc33ccd8f9ae246893f9dc.zip |
fix(share): render conflict modal in public shares
Handle templates with license comments in `octemplate.js`.
Signed-off-by: Max <max@nextcloud.com>
-rw-r--r-- | core/src/jquery/octemplate.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/src/jquery/octemplate.js b/core/src/jquery/octemplate.js index cecbe880aa6..83d6fd57d4f 100644 --- a/core/src/jquery/octemplate.js +++ b/core/src/jquery/octemplate.js @@ -83,7 +83,7 @@ const Template = { }, // From stackoverflow.com/questions/1408289/best-way-to-do-variable-interpolation-in-javascript _build(o) { - const data = this.elem.attr('type') === 'text/template' ? this.elem.html() : this.elem.get(0).outerHTML + const data = this._getData() try { return data.replace(/{([^{}]*)}/g, function(a, b) { @@ -95,6 +95,15 @@ const Template = { console.error(e, 'data:', data) } }, + _getData() { + if (this.elem.attr('type') === 'text/template') { + return this.elem.html() + } + // Leave out comments, etc and take the first html element + const htmlElem = $.makeArray(this.elem) + .find(e => e instanceof HTMLElement) + return htmlElem.outerHTML + }, options: { escapeFunction: escapeHTML, }, |