aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/notes/Notes.js
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/notes/Notes.js')
-rw-r--r--desktop/modules/notes/Notes.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/desktop/modules/notes/Notes.js b/desktop/modules/notes/Notes.js
index 6bc8c88..4e2ef3d 100644
--- a/desktop/modules/notes/Notes.js
+++ b/desktop/modules/notes/Notes.js
@@ -44,6 +44,15 @@ function parse(text) {
return valid(text) || { notes: [] };
}
+// A note's file name as db.json should hold it: digits only, the epoch second
+// notes.sh names the file with. Anything else is refused, because the page
+// builds a read path, a write path and an rm path from it, and a db.json that
+// came off a git remote is not entirely under this user's control.
+function validFile(file) {
+ const f = String(file === undefined || file === null ? "" : file);
+ return /^\d+$/.test(f) ? f : "";
+}
+
// Pretty, 2-space, trailing newline. notes.sh reads db.json through jq, which
// does not care about the layout.
function stringify(db) {