Skip to content

Commit

Permalink
🐛 Fix: url image hash bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Molunerfinn committed Jun 28, 2020
1 parent 379db06 commit e405221
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
IImgSize,
IPathTransformedImgInfo
} from './interfaces'
import { URL } from 'url'

export const isUrl = (url: string): boolean => (url.startsWith('http://') || url.startsWith('https://'))
export const isUrlEncode = (url: string): boolean => {
Expand Down Expand Up @@ -82,9 +83,10 @@ export const getURLFile = async (url: string): Promise<IPathTransformedImgInfo>
})
clearTimeout(timeoutId)
if (isImage) {
const urlPath = new URL(requestOptions.url).pathname
resolve({
buffer: res,
fileName: path.basename(requestOptions.url.split('?')[0]),
fileName: path.basename(urlPath),
extname,
success: true
})
Expand Down

0 comments on commit e405221

Please sign in to comment.