Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
Fix media with hashtags in their filenames (#745)
Browse files Browse the repository at this point in the history
  • Loading branch information
qsniyg committed Jul 11, 2020
1 parent 8a7f064 commit 54ddb18
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
4 changes: 2 additions & 2 deletions src/classes/filesystem.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 54ddb18

Please sign in to comment.