mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-01-23 06:38:13 -05:00
parent
404d7667e0
commit
4de7a1d5f2
@ -48,7 +48,7 @@
|
||||
"keycode": "^2.2.0",
|
||||
"lodash-id": "^0.14.0",
|
||||
"lowdb": "^1.0.0",
|
||||
"picgo": "^1.5.0-alpha.10",
|
||||
"picgo": "^1.5.0-alpha.15",
|
||||
"qrcode.vue": "^1.7.0",
|
||||
"shell-path": "2.1.0",
|
||||
"uuidv4": "^6.2.11",
|
||||
|
@ -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})`,
|
||||
|
@ -2,7 +2,7 @@ export const isUrl = (url: string): boolean => (url.startsWith('http://') || url
|
||||
export const isUrlEncode = (url: string): boolean => {
|
||||
url = url || ''
|
||||
try {
|
||||
return url !== decodeURIComponent(url)
|
||||
return url !== decodeURI(url)
|
||||
} catch (e) {
|
||||
// if some error caught, try to let it go
|
||||
return true
|
||||
@ -11,7 +11,7 @@ export const isUrlEncode = (url: string): boolean => {
|
||||
|
||||
export const handleUrlEncode = (url: string): string => {
|
||||
if (!isUrlEncode(url)) {
|
||||
url = encodeURIComponent(url)
|
||||
url = encodeURI(url)
|
||||
}
|
||||
return url
|
||||
}
|
||||
|
@ -9919,10 +9919,10 @@ performance-now@^2.1.0:
|
||||
resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
|
||||
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=
|
||||
|
||||
picgo@^1.5.0-alpha.10:
|
||||
version "1.5.0-alpha.10"
|
||||
resolved "https://registry.npmjs.org/picgo/-/picgo-1.5.0-alpha.10.tgz#fd567ac60c831395d5f16b80cf59646cab492c9a"
|
||||
integrity sha512-uFVFXxocbqXyc3lpGGIY2Sn55osXZWrTsNh9/CBSgJSqRVkp13nYnLMffZTp2+zzd/mDTpdqf/AUuEFI9dho+A==
|
||||
picgo@^1.5.0-alpha.15:
|
||||
version "1.5.0-alpha.15"
|
||||
resolved "https://registry.npmjs.org/picgo/-/picgo-1.5.0-alpha.15.tgz#406c1cd48afc5c98f1d5084596e8bcecb637ad58"
|
||||
integrity sha512-+uU2gbFi/kc5qi0wrqk0hSFusUqEYKTay9hIHcQ13un+7xx5kwir99mwwKpNB+K8wHARntjurN9HCZEszgTKmQ==
|
||||
dependencies:
|
||||
"@picgo/i18n" "^1.0.0"
|
||||
"@picgo/store" "^2.0.2"
|
||||
|
Loading…
Reference in New Issue
Block a user