Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hashtag "#books" links to 3rd party domain #3307

Open
fabiscafe opened this issue Mar 5, 2024 · 3 comments
Open

hashtag "#books" links to 3rd party domain #3307

fabiscafe opened this issue Mar 5, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@fabiscafe
Copy link

Describe the bug
Recently I wrote a comment on bookwyrm.social. While I was testing the hashtags, because of #2742 , I noticed that one of my hashtag "#books" links to https://the.talesofmy.life/search?tag=books

To Reproduce
Steps to reproduce the behavior:

  1. Go to Bookywyrm.social
  2. Post a comment with the hashtag "#books"
  3. Open that comment and click on #books

Expected behavior
It should just open other posts marked as #books

Instance
bookwyrm.social and since the link is embedded in the hashtag it's everywhere

Additional context
This seems to be a general problem with hashtags on bookwyrm, that they are hardcoded to one instance instead of flexible to resolve the hashtag on whatever instance the viewer clicks on them.

Comment with this problem: https://bookwyrm.social/user/fabiscafe/comment/4009858


Desktop (please complete the following information):
- OS: Arch Linux
- Browser: Firefox
- Version: 123

@fabiscafe fabiscafe added the bug Something isn't working label Mar 5, 2024
@Minnozz
Copy link
Contributor

Minnozz commented Mar 8, 2024

I think this code may be relevant:

# Replace links to hashtags in content with local URLs
changed_content = False
for hashtag in instance.mention_hashtags.all():
updated_content = re.sub(
rf'(<a href=")[^"]*(" data-mention="hashtag">{hashtag.name}</a>)',
rf"\1{hashtag.remote_id}\2",
instance.content,
flags=re.IGNORECASE,
)
if instance.content != updated_content:
instance.content = updated_content
changed_content = True

@gsergey418
Copy link

gsergey418 commented Mar 15, 2024

Screenshot_20240315_205716
Everything seems to work fine on my test instace, looks like a bookwyrm.social problem

@fabiscafe
Copy link
Author

So it might be that #books does have a broken entry in the database and bookwyrm looks it up without recheck if the url fits?
Something that cant be recreated with new instances, because it doesn't happen for newly added hashtags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants