From d56d0716cb451a3014b923e68dc1185f8835ef57 Mon Sep 17 00:00:00 2001 From: Lars Jung Date: Fri, 17 Feb 2012 11:28:08 +0100 Subject: [PATCH] Fixes problems with thumbnails for filenames with single and double quotes. --- README.md | 2 +- src/_h5ai/js/inc/Html.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 68981461..f71a4470 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ h5ai is provided under the terms of the [MIT License](http://github.com/lrsjng/h * fixes include problems in PHP version * fixes path problems on servers running on Windows in PHP version * fixes broken links in custom headers/footers while zipped download enabled - +* fixes problems with thumbnails for files with single or double quotes in filename ### v0.17 - *2011-11-28* diff --git a/src/_h5ai/js/inc/Html.js b/src/_h5ai/js/inc/Html.js index d95a07e8..6b092e47 100644 --- a/src/_h5ai/js/inc/Html.js +++ b/src/_h5ai/js/inc/Html.js @@ -74,8 +74,9 @@ if (H5AI.core.settings.showThumbs === true && $.inArray(path.type, thumbTypes) >= 0) { imgClass = "class='thumb'"; - icon16 = H5AI.core.api() + "?action=thumb&href=" + path.absHref + "&width=16&height=16&mode=square"; - icon48 = H5AI.core.api() + "?action=thumb&href=" + path.absHref + "&width=96&height=46&mode=rational"; + var escapedHref = path.absHref.replace(/'/g, "%27").replace(/"/g, "%22"); + icon16 = H5AI.core.api() + "?action=thumb&href=" + escapedHref + "&width=16&height=16&mode=square"; + icon48 = H5AI.core.api() + "?action=thumb&href=" + escapedHref + "&width=96&height=46&mode=rational"; } $label = $("" + path.label + "");