mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-01 12:42:28 +08:00
chore(routes/api/clipper): fix prefer-const lint errors
This commit is contained in:
parent
dd9e1e69d7
commit
272d7cd652
@ -30,12 +30,12 @@ function addClipping(req: Request) {
|
||||
// if a note under the clipperInbox has the same 'pageUrl' attribute,
|
||||
// add the content to that note and clone it under today's inbox
|
||||
// otherwise just create a new note under today's inbox
|
||||
let { title, content, pageUrl, images } = req.body;
|
||||
const { title, content, images } = req.body;
|
||||
const clipType = "clippings";
|
||||
|
||||
const clipperInbox = getClipperInboxNote();
|
||||
|
||||
pageUrl = htmlSanitizer.sanitizeUrl(pageUrl);
|
||||
const pageUrl = htmlSanitizer.sanitizeUrl(req.body.pageUrl);
|
||||
let clippingNote = findClippingNote(clipperInbox, pageUrl, clipType);
|
||||
|
||||
if (!clippingNote) {
|
||||
@ -100,16 +100,15 @@ function getClipperInboxNote() {
|
||||
}
|
||||
|
||||
function createNote(req: Request) {
|
||||
let { title, content, pageUrl, images, clipType, labels } = req.body;
|
||||
const { content, images, labels } = req.body;
|
||||
|
||||
if (!title || !title.trim()) {
|
||||
title = `Clipped note from ${pageUrl}`;
|
||||
}
|
||||
const clipType = htmlSanitizer.sanitize(req.body.clipType);
|
||||
const pageUrl = htmlSanitizer.sanitizeUrl(req.body.pageUrl);
|
||||
|
||||
clipType = htmlSanitizer.sanitize(clipType);
|
||||
const trimmedTitle = (typeof req.body.title === "string") ? req.body.title.trim() : "";
|
||||
const title = trimmedTitle || `Clipped note from ${pageUrl}`;
|
||||
|
||||
const clipperInbox = getClipperInboxNote();
|
||||
pageUrl = htmlSanitizer.sanitizeUrl(pageUrl);
|
||||
let note = findClippingNote(clipperInbox, pageUrl, clipType);
|
||||
|
||||
if (!note) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user