Skip to content

Commit c39e9ae

Browse files
committed
Checking files using regx
1 parent a60a963 commit c39e9ae

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

Diff for: src/avatar/b77bb8e52110f0ccd76935532078d4a2

59.5 KB
Binary file not shown.

Diff for: src/avatar/ff301e531e41cd46e53256d54be171da

68.3 KB
Binary file not shown.

Diff for: src/routers/user.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ var upload = multer({
7373
fileSize: 2000000
7474
},
7575
fileFilter(req, file, cb){
76-
if (!file.originalname.endsWith('.jpg')) {
77-
return cb(new Error('File must be an image of .jpg format'));
76+
if (!file.originalname.match(/\.(jpg|jpeg)$/)) {
77+
return cb(new Error('File must be an image of .jpg/.jpeg format'));
7878
}
7979

8080
cb(undefined,true);

0 commit comments

Comments
 (0)