File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
import { EventEmitter } from 'events'
2
2
import PicGo from './PicGo'
3
3
import { Plugin } from '../utils/interfaces'
4
+ import { handleUrlEncode } from '../utils/common'
4
5
5
6
class Lifecycle extends EventEmitter {
6
7
configPath : string
@@ -85,7 +86,7 @@ class Lifecycle extends EventEmitter {
85
86
let msg = ''
86
87
let length = ctx . output . length
87
88
for ( let i = 0 ; i < length ; i ++ ) {
88
- msg += ctx . output [ i ] . imgUrl
89
+ msg += handleUrlEncode ( ctx . output [ i ] . imgUrl )
89
90
if ( i !== length - 1 ) {
90
91
msg += '\n'
91
92
}
Original file line number Diff line number Diff line change 1
1
export const isUrl = ( url : string ) : boolean => ( url . startsWith ( 'http://' ) || url . startsWith ( 'https://' ) )
2
+ export const isUrlEncode = ( url : string ) : boolean => {
3
+ url = url || ''
4
+ return url !== decodeURI ( url )
5
+ }
6
+ export const handleUrlEncode = ( url : string ) : string => {
7
+ if ( ! isUrlEncode ( url ) ) {
8
+ url = encodeURI ( url )
9
+ }
10
+ return url
11
+ }
You can’t perform that action at this time.
0 commit comments