Repository navigation
Conversation
| # @return [String] safe username | ||
| def rtl_safe_username | ||
| "#{username}\u202D" | ||
| "#{username.gsub("\u0000", '').presence || "user#{id}"}\u202D" |
There was a problem hiding this comment.
I opted to extend the rtl_safe_username as we already use it pretty much everywhere where usernames would be considered untrusted user input. We should rename it to just safe_username or make it a generic sanitizer, but that's outside of scope of this PR.
The extension also makes sure that if the user tricks our validations with 3 null chars, they get user<id> displayed instead - same as with deleted users.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| require 'rmagick' | ||
|
|
||
| module Users::AvatarHelper | ||
| module AvatarHelper |
There was a problem hiding this comment.
This PR also moves avatar helpers to top level for consistency as this is the only scoped one (for users that is).
|
For testing: how do I create a bad username through the UI? (That is, how did people who've done this do it?) Or is that no longer possible but we have legacy usernames from before it was fixed? |
The best way is to not use the UI, just start the Rails repl in uwsgi and update any of the user's name to |
closes #2185