From 3375dc44e45dee0ba8fa44bc0863034ef3a179b2 Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Thu, 2 Mar 2023 16:04:48 -0600 Subject: [PATCH 1/3] Wrap URL string in quotes to avoid escaping issues This ensures that the browser will expect that single-quotes in the url string are not the end of the string, but part of the url. Fixes #31224 Signed-off-by: Colin Alworth --- core/src/OC/dialogs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/OC/dialogs.js b/core/src/OC/dialogs.js index 91b0e2fffeaf8..53cafe0649aca 100644 --- a/core/src/OC/dialogs.js +++ b/core/src/OC/dialogs.js @@ -1272,7 +1272,7 @@ const Dialogs = { var previewUrl = OC.generateUrl('/core/preview.png?') + $.param(urlSpec) img.onload = function() { if (img.width > 5) { - $row.find('td.filename').attr('style', 'background-image:url(' + previewUrl + ')') + $row.find('td.filename').attr('style', 'background-image:url(\"' + previewUrl + '\")') } } img.src = previewUrl From bbb00de02f0b44f34aeca7849af280d25f56b2e5 Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Thu, 2 Mar 2023 17:18:32 -0600 Subject: [PATCH 2/3] Review feedback, using template literals instead of concat Signed-off-by: Colin Alworth --- core/src/OC/dialogs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/OC/dialogs.js b/core/src/OC/dialogs.js index 53cafe0649aca..e38d48fecf6b9 100644 --- a/core/src/OC/dialogs.js +++ b/core/src/OC/dialogs.js @@ -1272,7 +1272,7 @@ const Dialogs = { var previewUrl = OC.generateUrl('/core/preview.png?') + $.param(urlSpec) img.onload = function() { if (img.width > 5) { - $row.find('td.filename').attr('style', 'background-image:url(\"' + previewUrl + '\")') + $row.find('td.filename').attr('style', `background-image: url("${previewUrl}")`); } } img.src = previewUrl From 56e6b50ea5169a8229c043e8e3a920e504cd5610 Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Thu, 2 Mar 2023 19:01:51 -0600 Subject: [PATCH 3/3] Also modify the original html template Signed-off-by: Colin Alworth --- core/templates/filepicker.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/templates/filepicker.html b/core/templates/filepicker.html index 484a6e12d2b3f..a10a633cfd7b6 100644 --- a/core/templates/filepicker.html +++ b/core/templates/filepicker.html @@ -45,7 +45,7 @@

{emptytext}

+ style="background-image:url("{icon}")"> {filename1} {filename2}