Error in redirect when clicking Follow button from With Replies page (Mastodon v4)
louisbourque opened this issue · 1 comments
Bug description
When clicking the Follow button from the "Posts and replies" page, the username seems to be incorrectly parsed from the URL. The result is a redirect to "https:///authorize_interaction?uri=with_replies@". The "with_replies" is where their actual username should appear.
Steps to reproduce
- Go to a Mastodon user you don't follow.
- Click Posts and Replies or Media
- Click the Follow button
Actual behavior
The URL opened does not include the user's username, but instead the last part of the URL. ('with_replies" if on the Post and Replies section)
Expected behavior
The username should be passed to the redirect URL and not just the last part of the original URL
System
Browser and version: Firefox
Add-on version: 2.0
Mastodon: v4
Possible solution
As best I can tell, the issue is this line:
is just taking the last part of the URL after the last /.This works fine for https://mastodon.social/@username
But with a URL like https://mastodon.social/@username/with_replies, it incorrectly uses the "with_replies" part as the username.
Perhaps something like
const username = window.location.pathname.split("/").find(string => string.startsWith('@'))
would be more flexible?
Also, just wanted to say Thank You for this extension, it's very convenient.
Thanks a lot for that detailed bug report/writeup! Without having tested/reproduced the issue that seems very plausible and easy to fix, so feel free to create a PR and test it.
So it would be great if you could try out the development version and submit a patch.