Fix media with hashtags in their filenames (#745)

This commit is contained in:
qsniyg 2020-07-11 08:46:17 -07:00 committed by GitHub
parent 8a7f064b77
commit 54ddb18de3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -13,6 +13,9 @@ window._escapeHtml = text => {
};
return text.replace(/[&<>"']/g, m => {return map[m];});
};
window._encodePathURI = uri => {
return encodeURI(uri).replace(/#/g, "%23");
};
window._purifyCSS = str => {
if (typeof str === "undefined") return "";
if (typeof str !== "string") {

View File

@ -548,11 +548,11 @@ class FilesystemDisplay {
switch(type || block.type) {
case "image":
html = `<img class="fsDisp_mediaDisp" src="${path || block.path}" ondragstart="return false;">`;
html = `<img class="fsDisp_mediaDisp" src="${window._encodePathURI(path || block.path)}" ondragstart="return false;">`;
break;
case "video":
html = `<video class="fsDisp_mediaDisp" controls preload="auto">
<source src="${path || block.path}">
<source src="${window._encodePathURI(path || block.path)}">
Unsupported video format!
</video>`;
break;