Skip to content

Commit

Permalink
Fix cant change icon (#35)
Browse files Browse the repository at this point in the history
* [fix] - jpegのアイコン消せてなかった

* [fix] - jpeg|jpgを自動的に判別してくれなかったらしい
  • Loading branch information
NfoAlex authored May 16, 2024
1 parent 71474fc commit f666363
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/fileHandler/multerHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ module.exports = (app:any) => {
if (fs.existsSync(newDir + "/" + RequestSender.userId + ".jpg")) {
fs.unlinkSync(newDir + "/" + RequestSender.userId + ".jpg");
}
if (fs.existsSync(newDir + "/" + RequestSender.userId + ".jpeg")) {
fs.unlinkSync(newDir + "/" + RequestSender.userId + ".jpeg");
}
if (fs.existsSync(newDir + "/" + RequestSender.userId + ".gif")) {
fs.unlinkSync(newDir + "/" + RequestSender.userId + ".gif");
}
Expand Down Expand Up @@ -100,6 +103,10 @@ module.exports = (app:any) => {
res.sendFile(absolutePath + "/" + req.params.userid + ".jpg");
return;
}
if (fs.existsSync(absolutePath + "/" + req.params.userid + ".jpeg")) {
res.sendFile(absolutePath + "/" + req.params.userid + ".jpeg");
return;
}
if (fs.existsSync(absolutePath + "/" + req.params.userid + ".gif")) {
res.sendFile(absolutePath + "/" + req.params.userid + ".gif");
return;
Expand Down

0 comments on commit f666363

Please sign in to comment.