fix(SessionService): sanitize displayName to utf8 encoding by silverkszlo · Pull Request #8405 · nextcloud/text
Conversation
📝 Summary
A user reported that they can not open text/md files and were getting the following error message: "Malformed UTF-8 characters, possibly incorrectly encoded", while most other users could open the same file without a problem.
This PR uses EncodingService to convert display names from external backends (e.g. LDAP/AD) to UTF-8 before including them in JSON responses.
🏁 Checklist
- Code is properly formatted (
npm run lint/npm run stylelint/composer run cs:check) - Sign-off message is added to all commits
- Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
- Documentation (README or documentation) has been updated or is not required
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting corner case and I wonder whether this would need to be applied in other places as well. Searching for [dD]isplayName revealed at least lib/Notification/Notifier.php and lib/Controller/UserApiController.php.
But fine with merging as is. A comment in the code would be nice to make it clear for the future why we do the extra sanitizing there.
Ahh, I just now realized that this is supposed to be merged to stable32 directly. Any particular reason why the fix is not targeting main first (and backported from there)?
Ahh, I just now realized that this is supposed to be merged to
stable32directly. Any particular reason why the fix is not targetingmainfirst (and backported from there)?
No good reason, I just started developing in 32 as the user reported their issue in that version and then I have just noticed, after creating the PR, that it would have made more sense to apply that in main directly. I'll add the change to the other branches soon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters