Skip to content

Commit

Permalink
fix images with space in file name
Browse files Browse the repository at this point in the history
  • Loading branch information
korelstar committed Mar 20, 2022
1 parent 53ecbba commit 3e991d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/EditorEasyMDE.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ export default {
}
const label = basename(path)
const relativePath = relative(currentNotePath, path)
doc.replaceRange('![' + label + '](' + relativePath + ')\n', { line: cursor.line })
const encodedPath = relativePath.split('/').map(encodeURIComponent).join('/')
doc.replaceRange('![' + label + '](' + encodedPath + ')\n', { line: cursor.line })
this.mde.codemirror.focus()
},
false,
Expand Down
5 changes: 4 additions & 1 deletion src/components/EditorMarkdownIt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ export default {
) {
path = path.split('?').shift()
const lowecasePath = path.toLowerCase()
path = generateUrl('apps/notes/notes/{id}/attachment?path={path}', { id, path })
path = generateUrl(
'apps/notes/notes/{id}/attachment?path={path}',
{ id, path: decodeURIComponent(path) },
)
token.attrs[aIndex][1] = path
if (!lowecasePath.endsWith('.jpg')
Expand Down

0 comments on commit 3e991d4

Please sign in to comment.