TwidereProject / Twidere-Android

http://twidere.com
2.76k stars 378 forks source link

Incorrectly builds Mastodon user handle from mentions #1001

Open ClearlyClaire opened 6 years ago

ClearlyClaire commented 6 years ago

Expected behavior

When parsing a mention, Twidere should use server-supplied user and domain fields matching an account to build a user handle.

Actual behavior

Twidere builds the user handle from the mention text and the host part of the user's URI. While this is the most common case, it is not mandated by Mastodon nor any of the protocols it supports. In particular, Mastodon allows instances to be served under a different name than the user it serves (see the WEB_DOMAIN Mastodon setting). For instance, my handle @thib@sitedethib.com is technically handled by social.sitedethib.com, thus having a https://social.sitedethib.com/users/Thib URI. Twidere thus builds @Thib@social.sitedethib.com instead of the (server-provided) @Thib@sitedethib.com.

Steps to reproduce

  1. Reply to a toot containing a mention to a user with WEB_DOMAINLOCAL_DOMAIN (e.g. @thib@sitedethib.com)
  2. Reply will be pre-filled with incorrect mention
ghost commented 6 years ago

@ThibG Try either Mastalab or Tusky for Mastodon. For Twidere, the priority is Twitter, not Mastodon.

ClearlyClaire commented 6 years ago

@iknownothingaboutcomputers after a quick reading of both alternatives' source code, they indeed seem to not have this issue, as they are getting mention info from Mastodon's json API instead of parsing them themselves. However, I am currently not searching for an alternative, and this is a bug in Twidere, whether that's considered of low priority or not.