Skip to content

Commit

Permalink
fix: upload preview can't show image when the image file use uppercas…
Browse files Browse the repository at this point in the history
…e extension

	1.fix: upload preview can't show image when the image file use uppercase extension.
	2.improve: remove unnecessary escape character.
  • Loading branch information
sliwey committed Jun 15, 2018
1 parent a5ff8e5 commit f614668
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions components/upload/UploadList.tsx
Expand Up @@ -19,13 +19,13 @@ const extname = (url: string) => {
}
const temp = url.split('/');
const filename = temp[temp.length - 1];
const filenameWithoutSuffix = filename.split(/\#|\?/)[0];
const filenameWithoutSuffix = filename.split(/#|\?/)[0];
return (/\.[^./\\]*$/.exec(filenameWithoutSuffix) || [''])[0];
};

const isImageUrl = (url: string): boolean => {
const extension = extname(url);
if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|bmp)$/.test(extension)) {
if (/^data:image\//.test(url) || /(webp|svg|png|gif|jpg|jpeg|bmp)$/i.test(extension)) {
return true;
} else if (/^data:/.test(url)) { // other file types of base64
return false;
Expand Down

0 comments on commit f614668

Please sign in to comment.