From 9044e283ecd6b864ccf035d80b92453d15340ede Mon Sep 17 00:00:00 2001 From: shanshuirenjia <978987373@qq.com> Date: Tue, 18 Jan 2022 17:28:10 +0800 Subject: [PATCH] repair code bug --- frontend/src/markdown-editor.js | 4 ++-- frontend/src/shared-file-view-markdown.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/markdown-editor.js b/frontend/src/markdown-editor.js index 76c5c233ea..153e855a35 100644 --- a/frontend/src/markdown-editor.js +++ b/frontend/src/markdown-editor.js @@ -26,7 +26,7 @@ const { siteRoot, serviceUrl, seafileCollabServer } = window.app.config; const userInfo = window.app.userInfo; const userName = userInfo.username; let dirPath = Utils.getDirName(filePath); -const IMAGE_SUFFIXES = ['png', 'PNG', 'jpg', 'JPG', 'gif', 'GIF']; +const IMAGE_SUFFIXES = ['png', 'PNG', 'jpg', 'jpeg', 'JPG', 'gif', 'GIF']; function getImageFileNameWithTimestamp() { var d = Date.now(); @@ -734,7 +734,7 @@ class MarkdownEditor extends React.Component { const fileName = Utils.getFileName(filePath); const suffix = fileName.slice(fileName.indexOf('.') + 1); if (IMAGE_SUFFIXES.includes(suffix)) { - let innerURL = serviceUrl + '/lib/' + repoID + '/file' + Utils.encodePath(filePath) + '?raw=1'; + let innerURL = serviceUrl + '/lib/' + repoID + '/file' + filePath + '?raw=1'; window.richMarkdownEditor.addLink(fileName, innerURL, true); return; } diff --git a/frontend/src/shared-file-view-markdown.js b/frontend/src/shared-file-view-markdown.js index 3995267b94..2f5f55a7e4 100644 --- a/frontend/src/shared-file-view-markdown.js +++ b/frontend/src/shared-file-view-markdown.js @@ -55,7 +55,7 @@ class FileContent extends React.Component { let index2 = imagePath.indexOf('?'); imagePath = imagePath.substring(index + 5, index2); // change image url - innerNode.data.src = serviceURL + '/view-image-via-share-link/?token=' + sharedToken + '&path=' + Utils.encodePath(imagePath); + innerNode.data.src = serviceURL + '/view-image-via-share-link/?token=' + sharedToken + '&path=' + imagePath; } return innerNode; }