fix tags for new images

This commit is contained in:
Zutatensuppe 2021-06-03 00:01:42 +02:00
parent 57a1e9f24d
commit b88321bb1b
2 changed files with 4 additions and 2 deletions

View file

@ -2057,7 +2057,8 @@ app.post('/api/upload', (req, res) => {
created: Time.timestamp(), created: Time.timestamp(),
}); });
if (req.body.tags) { if (req.body.tags) {
setImageTags(db, imageId, req.body.tags); const tags = req.body.tags.split(',').filter((tag) => !!tag);
setImageTags(db, imageId, tags);
} }
res.send(Images.imageFromDb(db, imageId)); res.send(Images.imageFromDb(db, imageId));
}); });

View file

@ -182,7 +182,8 @@ app.post('/api/upload', (req, res): void => {
}) })
if (req.body.tags) { if (req.body.tags) {
setImageTags(db, imageId as number, req.body.tags) const tags = req.body.tags.split(',').filter((tag: string) => !!tag)
setImageTags(db, imageId as number, tags)
} }
res.send(Images.imageFromDb(db, imageId as number)) res.send(Images.imageFromDb(db, imageId as number))