Fix consistency check for link finder function

This commit is contained in:
Daniel - 2020-09-26 15:12:28 +02:00
parent cde56c819e
commit 994be97397
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 6 additions and 2 deletions

View File

@ -607,9 +607,13 @@ if in Org Mode."
(interactive (when (derived-mode-p 'org-mode)
(list (org-id-get) (org-entry-get nil "CUSTOM_ID"))))
(unless (string-match-p "^[a-f0-9]\\{8\\}-[a-f0-9]\\{4\\}-[a-f0-9]\\{4\\}-[a-f0-9]\\{4\\}-[a-f0-9]\\{12\\}$" id)
(unless (or (not id)
(and (stringp id)
(string-match-p "^[a-f0-9]\\{8\\}-[a-f0-9]\\{4\\}-[a-f0-9]\\{4\\}-[a-f0-9]\\{4\\}-[a-f0-9]\\{12\\}$" id)))
(user-error "Given ID is not a valid UUID: %s" id))
(unless (string-match-p "[-a-zA-Z0-9]" custom-id)
(unless (or (not custom-id)
(and (stringp custom-id)
(string-match-p "[-a-zA-Z0-9]" custom-id)))
;; sorry, only ASCII right now …
(user-error "CUSTOM_ID must consist of alphanumeric charaters only"))