diff options
author | marty hiatt <martianhiatus@riseup.net> | 2024-08-13 15:08:27 +0200 |
---|---|---|
committer | marty hiatt <martianhiatus@riseup.net> | 2024-08-13 15:08:27 +0200 |
commit | e1e44d43daf78c5fc83a8bcc8d29613d4fc56175 (patch) | |
tree | 83b3ecd17aa378f1d2717c67bc47cb6cce023768 /lisp | |
parent | e8d8f6307628a4fedc2836fe5bd3f58dc9d0c61f (diff) |
fix a bunch of tests
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mastodon-tl.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/mastodon-tl.el b/lisp/mastodon-tl.el index 21aa1c4..944e662 100644 --- a/lisp/mastodon-tl.el +++ b/lisp/mastodon-tl.el @@ -971,16 +971,20 @@ this should be of the form <at-sign><user id>, e.g. \"@Gargon\"." buffer-text ; no instance suffix for local mention (concat buffer-text "@" host))))) -(defun mastodon-tl--hashtag-from-url (url _instance-url) +(defun mastodon-tl--hashtag-from-url (url instance-url) "Return the hashtag that URL points to or nil if URL is not a tag link. INSTANCE-URL is the url of the instance for the toot that the link came from (tag links always point to a page on the instance publishing the toot)." - ;; FIXME: do we rly need to check it against instance-url? - (let* ((parsed (url-generic-parse-url url)) + ;; TODO: do we rly need to check it against instance-url? + ;; test suggests we might + (let* ((instance-host (url-host + (url-generic-parse-url instance-url))) + (parsed (url-generic-parse-url url)) (path (url-filename parsed)) (split (string-split path "/"))) - (when (string-prefix-p "/tag" path) ;; "/tag/" or "/tags/" + (when (and (string= instance-host (url-host parsed)) + (string-prefix-p "/tag" path)) ;; "/tag/" or "/tags/" (nth 2 split)))) |