Skip to content

Commit 405fe0e

Browse files
committed
edited notes: more restrictive check
TriliumNext#7704 (comment)
1 parent 25844d6 commit 405fe0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/server/src/routes/api/edited-notes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ export function dateNoteLabelKeywordToDateFilter(dateStr: string): DateFilter {
182182
}
183183

184184
function isValidDatePrefix(dateStr: string): boolean {
185-
// Check if it starts with YYYY format
186-
if (/^\d{4}/.test(dateStr)) {
185+
// Check if it starts with YYYY format and only contains numbers and dashes afterwards
186+
if (/^\d{4}[-\d]*$/.test(dateStr)) {
187187
const year = parseInt(dateStr.substring(0, 4));
188188
return !isNaN(year) && year > 0 && year < 10000;
189189
}

0 commit comments

Comments
 (0)