mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Move background file instead of copying+deleting
This commit is contained in:
@@ -76,10 +76,9 @@ router.post('/upload', urlencodedParser, function (request, response) {
|
|||||||
const filename = request.file.originalname;
|
const filename = request.file.originalname;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fs.copyFileSync(img_path, path.join('public/backgrounds/', filename));
|
fs.renameSync(img_path, path.join('public/backgrounds/', filename));
|
||||||
invalidateThumbnail('bg', filename);
|
invalidateThumbnail('bg', filename);
|
||||||
response.send(filename);
|
response.send(filename);
|
||||||
fs.unlinkSync(img_path);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
response.sendStatus(500);
|
response.sendStatus(500);
|
||||||
|
Reference in New Issue
Block a user