From 3219441fdfa142341631786e7ea9b588479c47b2 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 11 Jul 2020 23:05:28 +0200 Subject: [PATCH] fallback for missing parsed title, closes trilium-web-clipper/issues/16 --- src/routes/api/clipper.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index 6ad2efea4..f6917f00d 100644 --- a/src/routes/api/clipper.js +++ b/src/routes/api/clipper.js @@ -65,7 +65,11 @@ async function addClipping(req) { } async function createNote(req) { - const {title, content, pageUrl, images, clipType} = req.body; + let {title, content, pageUrl, images, clipType} = req.body; + + if (!title || !title.trim()) { + title = "Clipped note from " + pageUrl; + } log.info(`Creating clipped note from ${pageUrl}`); @@ -155,4 +159,4 @@ module.exports = { addClipping, openNote, handshake -}; \ No newline at end of file +};