We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 379db06 commit e405221Copy full SHA for e405221
src/utils/common.ts
@@ -7,6 +7,7 @@ import {
7
IImgSize,
8
IPathTransformedImgInfo
9
} from './interfaces'
10
+import { URL } from 'url'
11
12
export const isUrl = (url: string): boolean => (url.startsWith('http://') || url.startsWith('https://'))
13
export const isUrlEncode = (url: string): boolean => {
@@ -82,9 +83,10 @@ export const getURLFile = async (url: string): Promise<IPathTransformedImgInfo>
82
83
})
84
clearTimeout(timeoutId)
85
if (isImage) {
86
+ const urlPath = new URL(requestOptions.url).pathname
87
resolve({
88
buffer: res,
- fileName: path.basename(requestOptions.url.split('?')[0]),
89
+ fileName: path.basename(urlPath),
90
extname,
91
success: true
92
0 commit comments