Convalida nome utente Unicode (Russian) fallisce in modo casuale

I nomi utente con caratteri russi, ad esempio фыв (non sono sicuro se dipenda da caratteri specifici), a volte falliscono la validazione.

Testato nell’ultima versione di Chrome e Firefox su Ubuntu 19.10; la versione di Discourse è 2.4.0.beta8 (16de46f8d4).

La richiesta HTTP sembra essere sempre la stessa per questi tre caratteri, riproducibile ripetendoli più volte nella Console degli Strumenti per sviluppatori:

fetch('/u/check_username?username=%D1%84%D1%8B%D0%B2&email=', {headers: {'X-Requested-With': 'XMLHttpRequest'}}).then(r => r.json()).then(console.log)

Ho provato a impostare l’elenco bianco Unicode [йцукенгшщзхъфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮёЁ], senza alcun effetto.

@gerhard any idea what is going on here? Is our Russian regex incorrect?

I can’t reproduce the issue. Any chance that you entered some kind of invisible whitespace or something like that when it showed you the “must only include numbers, letters, dashes, dots, and underscores” error message?

The username check runs on the server, so if there was a problem with the regex, it should always generate the same results for the same input.

2 Mi Piace

Yes, that’s why it’s strange.

I thought that it could be related to some kind of rate limiting, but now I got the error even after a long pause (2 minutes) on the first request, and then success on the third request in several seconds.

I can reproduce it executing the code above in DevTools.

I’m still not able to reproduce the issue. Could you please try to disable and reenable the unicode usernames site setting? Maybe a unicorn worker didn’t get the memo that the setting changed. That would explain why only some of the requests result in an error. If that doesn’t help, try rebuilding the app container.

2 Mi Piace

It didn’t help, but yes, I cannot reproduce it too in my local Docker instance and looks like it disappeared after restart when upgrading Discourse.

btw if anyone is looking for a simpler way to whitelist Russian letters, looks like this regex works: [\p{Cyrillic}]

1 Mi Piace