diff options
author | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-09-12 14:06:59 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus [a t] riseup [d o t] net> | 2022-09-12 14:07:53 +0200 |
commit | 479bdf4becba035a74243514ce82d37c12d02bfa (patch) | |
tree | 4e5af4be1d603415bae70fcfc00168ded7c55986 | |
parent | 07d6f12385bfde67ad3da51dfb4457b0737161ed (diff) |
improve masto-url-p regexes for users
-rw-r--r-- | lisp/mastodon.el | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lisp/mastodon.el b/lisp/mastodon.el index 0c6104f..d773d24 100644 --- a/lisp/mastodon.el +++ b/lisp/mastodon.el @@ -302,12 +302,12 @@ not, just browse the URL in the normal fashion." (defun mastodon--masto-url-p (query) "Check if QUERY resembles a fediverse URL." ;; calqued off https://github.com/tuskyapp/Tusky/blob/c8fc2418b8f5458a817bba221d025b822225e130/app/src/main/java/com/keylesspalace/tusky/BottomSheetActivity.kt - ;; TODO: remove domain and add ^ to regex: - ;; (let ((query-path (url-file-nondirectory query))) + ;; thx to Conny Duck! (let* ((uri-parsed (url-generic-parse-url query)) (query (url-filename uri-parsed))) (save-match-data - (or (string-match "^/@[[:alnum:]]+/[[:digit:]]+$" query) + (or (string-match "^/@[^/]+$" query) + (string-match "^/@[^/]+/[[:digit:]]+$" query) (string-match "^/users/[[:alnum:]]+$" query) (string-match "^/notice/[[:alnum:]]+$" query) (string-match "^/objects/[-a-f0-9]+$" query) |