Move background file instead of copying+deleting

This commit is contained in:
valadaptive 2023-12-07 15:26:51 -05:00
parent e7dce9b107
commit c0a7472fe9
1 changed files with 1 additions and 2 deletions

View File

@ -76,10 +76,9 @@ router.post('/upload', urlencodedParser, function (request, response) {
const filename = request.file.originalname;
try {
fs.copyFileSync(img_path, path.join('public/backgrounds/', filename));
fs.renameSync(img_path, path.join('public/backgrounds/', filename));
invalidateThumbnail('bg', filename);
response.send(filename);
fs.unlinkSync(img_path);
} catch (err) {
console.error(err);
response.sendStatus(500);