From fefb059564f127c28f7f8f05dbc119b23e93f1df Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 8 Aug 2023 23:07:59 +0200 Subject: [PATCH] clipper now creates notes with image attachments instead of image notes --- src/routes/api/clipper.js | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index 9452c08c5..523a7a4fb 100644 --- a/src/routes/api/clipper.js +++ b/src/routes/api/clipper.js @@ -152,20 +152,9 @@ function processContent(images, note, content) { const buffer = Buffer.from(dataUrl.split(",")[1], 'base64'); - const {note: imageNote, url} = imageService.saveImage(note.noteId, buffer, filename, true); - - new BAttribute({ - noteId: imageNote.noteId, - type: 'label', - name: 'archived' - }).save(); // so that these image notes don't show up in search / autocomplete - - new BAttribute({ - noteId: note.noteId, - type: 'relation', - name: 'imageLink', - value: imageNote.noteId - }).save(); + const attachment = imageService.saveImageToAttachment(note.noteId, buffer, filename, true); + const sanitizedTitle = attachment.title.replace(/[^a-z0-9-.]/gi, ""); + const url = ``; log.info(`Replacing '${imageId}' with '${url}' in note '${note.noteId}'`);