未验证 提交 54ddb18d 编写于 作者: Q qsniyg 提交者: GitHub

Fix media with hashtags in their filenames (#745)

上级 8a7f064b
......@@ -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") {
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册