[improvement] Uploader: support more image types (#4140)

This commit is contained in:
neverland
2019-08-18 11:16:44 +08:00
committed by GitHub
parent 67fc817cfd
commit b573ba9f6a
2 changed files with 6 additions and 2 deletions

View File

@@ -33,10 +33,10 @@ export type FileListItem = {
isImage?: boolean;
};
const IMAGE_EXT = ['jpeg', 'jpg', 'gif', 'png', 'svg'];
const IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
export function isImageUrl(url: string): boolean {
return IMAGE_EXT.some(ext => url.indexOf(`.${ext}`) !== -1);
return IMAGE_REGEXP.test(url);
}
export function isImageFile(item: FileListItem): boolean {