fixes of new attachment URLs

This commit is contained in:
zadam
2023-04-17 22:40:53 +02:00
parent b84670d503
commit 0e4a040ed8
6 changed files with 2742 additions and 65 deletions

View File

@@ -44,15 +44,9 @@ function returnImage(req, res) {
}
function returnAttachedImage(req, res) {
const note = becca.getNote(req.params.noteId);
if (!note) {
return res.sendStatus(404);
}
const attachment = becca.getAttachment(req.params.attachmentId);
if (!attachment || attachment.parentId !== note.noteId) {
if (!attachment) {
res.set('Content-Type', 'image/png');
return res.send(fs.readFileSync(`${RESOURCE_DIR}/db/image-deleted.png`));
}