commit fa6aed3f1669d446aca399dcbf396eac76c82eff
parent 34a219da26808fdde4babed986a66543af878d22
Author: Spencer Williams <spnw@plexwave.org>
Date: Tue, 8 Apr 2025 11:02:09 -0400
Fix bug that allows notes to be created with empty slug
Diffstat:
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/CHANGES.org b/CHANGES.org
@@ -41,3 +41,5 @@
- Seam now validates note types entered with =C-u seam-set-note-type=,
averting any mishaps if your completing-read function returns an
invalid type.
+
+- It is no longer possible to create a note with an empty slug.
diff --git a/lisp/seam.el b/lisp/seam.el
@@ -196,6 +196,8 @@ naming. Must be a function taking two arguments: TITLE and TYPE."
(file (file-name-concat seam-note-directory
type
(concat slug ".org"))))
+ (when (string= "" slug)
+ (error "Cannot create a note with an empty slug"))
(seam--check-conflict slug)
(let ((buffer (funcall (if select #'find-file #'find-file-noselect) file)))
(with-current-buffer buffer