fixed docker deployment
This commit is contained in:
@@ -20,7 +20,7 @@ const handlePostData = async (req: Request, res: Response, next: NextFunction):
|
||||
|
||||
if (postToUpdate.type == 1) {
|
||||
const filename = postToUpdate.message;
|
||||
fs.rmSync(`${process.env.UPLOAD_DESTINATION}/${filename}`);
|
||||
fs.unlinkSync(`${process.env.UPLOAD_DESTINATION}/${filename}`);
|
||||
}
|
||||
}
|
||||
if (req.file) {
|
||||
@@ -33,9 +33,10 @@ const handlePostData = async (req: Request, res: Response, next: NextFunction):
|
||||
const hash = crypto.createHash('md5');
|
||||
hash.update(buffer);
|
||||
const newFilename = `${hash.digest('hex')}${extension}`;
|
||||
fs.renameSync(`./${req.file.path}`, `${process.env.UPLOAD_DESTINATION}/${newFilename}`)
|
||||
post.message = newFilename
|
||||
post.type = 1
|
||||
fs.copyFileSync(`./${req.file.path}`, `${process.env.UPLOAD_DESTINATION}/${newFilename}`);
|
||||
fs.unlinkSync(`./${req.file.path}`);
|
||||
post.message = newFilename;
|
||||
post.type = 1;
|
||||
} else {
|
||||
post.type = 0;
|
||||
post.message = message;
|
||||
|
||||
Reference in New Issue
Block a user