🐛 Fix: url encode bug && copy-paste url encode bug

ISSUES CLOSED: #996
This commit is contained in:
PiEgg
2022-10-24 17:14:39 +08:00
parent 404d7667e0
commit 4de7a1d5f2
4 changed files with 9 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
import { IPasteStyle } from '#/types/enum'
import { handleUrlEncode } from '#/utils/common'
const formatCustomLink = (customLink: string, item: ImgInfo) => {
const fileName = item.fileName!.replace(new RegExp(`\\${item.extname}$`), '')
@@ -18,7 +19,7 @@ const formatCustomLink = (customLink: string, item: ImgInfo) => {
}
export default (style: IPasteStyle, item: ImgInfo, customLink: string | undefined) => {
const url = item.url || item.imgUrl
const url = handleUrlEncode(item.url || item.imgUrl)
const _customLink = customLink || '$url'
const tpl = {
markdown: `![](${url})`,