Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
[GitHub Bug #1651] @user doesn't always work
If I write a comment beginning @SovereignBleak, for example, about half the time Vanilla will link to my user profile, and the other half fails to format at all.
Is there a fix?
Is there a fix?
Tagged:
0
Comments
@Lincoln: Has the issue of @username with common characters in other languages like ä, ö, ü, ñ, found a way to the issues of the Vanilla repository on GitHub. I think this very important as linkings are now broken if @usernäme is written for example. The text only link is "@usern" while "äme" is treated like standard text. As username registration with these character is possible it would be great to see this in a 2.0.18.9? Thanx for info.
I believe this was fixed for 2.1 if you have the proper regex libraries (most modern PHP installs do).
Thanx for response. I've tested in 2.2 where the problem still resists. Can we assume then, that there could be a fix in 2.1? Mmh... I'm asking here first because i don't want to create duplicate GitHub tickets and i had no proper search term in mind to look the hub up on this issue.
I'm wrong, I made this patch to the URL matcher, not mentions. It should get a bug ticket.
Alright can you do this as i'm not firm with the naming conventions so you internally understand. You'd be faster. Please do also support a probable 2.0.18.9 update. smile
Bug Ticket created. https://github.com/vanillaforums/Garden/issues/1651
There was an error rendering this rich post.
I've taken a look at the function
GetMentions
fromlibrary/core/functions.general.php
. This function is "buggy", too, to my opinion. It looks for @usernames with following regex:\w{3,20}
is a standard which can be overwritten withC("Garden.User.ValidationRegex")
andC("Garden.User.ValidationLength","{3,20}")
. That means, thatGetMentions
will not use custom username rules.Username validation uses a function from
/library/core/functions.validation.php
calledValidateUsernameRegex
that, by default, gives back following string:[\d\w_]{3,20}
which is different to the search string used inGetMentions
.And so,
GetMentions
doesn't test for valid usernamesThat will fix notifications, but not the display. That is handled in function
Mentions
in/library/core/class.format.php
. Here again is an individual regex (\w{1,50}) that differs from the standard:The Umlaut-problem could be solved in 3 steps.
Mentions
in/library/core/class.format.php
and change it to this:GetMentions
inlibrary/core/functions.general.php
and change it to that:config.php
and change it as you like (take existing usernames into consideration!)That's it! :-)
I'd like to make a pull request in GitHub, but I'm a GitHub noob. Must it be done from the master branch? Does it help anybody if I make it also from the 2.0 branch (which is version 2.0.18.8 as far as I have understood) or is this the git equivalent to necroposting?
But what I still do not understand is that registering as user 'täst' is no problem with default regex \w, but parsing the mentioning of @täst doesn't work...
As long as that is not explained, it might be more consistend to change the default regex for usernames to [\d_a-zA-Z] so that it is obvious that special characters have to be configured...
That registering and GetMentions use different regex is a mistake.
Some folk have user names with spaces, and other characters that aren't compatible with idealised mentions or user names, it depend how their userbase was imported.
I know this from experience of fielding questions on MentionsLookup. If you can think of it is out there.
It would make sense encapsulate mentions e.g.
@Some User
grep is your friend.
Not supporting spaces or encapsulation isn't a bug tho, that's a feature request.