From 3b8e1499227711d63a2b4c368b15d0112e62b2cd Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 12 Sep 2018 23:51:50 -0700 Subject: [PATCH] Fix ' in filenames Signed-off-by: James Ketrenos --- frontend/elements/photo-thumbnail.html | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/elements/photo-thumbnail.html b/frontend/elements/photo-thumbnail.html index be5e579..4f198d8 100755 --- a/frontend/elements/photo-thumbnail.html +++ b/frontend/elements/photo-thumbnail.html @@ -84,7 +84,7 @@ thumbChanged: function(thumbpath, visible) { if (visible) { - this.style.backgroundImage = "url(" + thumbpath + ")"; + this.style.backgroundImage = "url(" + encodeURI(thumbpath).replace(/'/g, "\\'") + ")"; } else { this.style.backgroundImage = ""; } @@ -96,7 +96,10 @@ }, safeItemThumbFilepath: function(item, base) { - return "'" + (base + encodeURI(item.path) + "/thumbs/" + encodeURI(item.filename)).replace(/'/, "\\'") + "'"; + if (!item || !base || !item.path) { + return ""; + } + return base + item.path + "/thumbs/" + item.filename; }, date: function(item) {