Fix handling of invalid charsets on remote sites#4007
Merged
LeoColomb merged 2 commits intoYOURLS:masterfrom Oct 28, 2025
Merged
Fix handling of invalid charsets on remote sites#4007LeoColomb merged 2 commits intoYOURLS:masterfrom
LeoColomb merged 2 commits intoYOURLS:masterfrom
Conversation
Member
|
What a sexy PR. Fix issue, add tests. ❤️ |
ozh
approved these changes
Oct 24, 2025
Includes a test case to check for the invalid utf=8 encoding in YOURLS#3708
…ote response is a valid one. This will now not convert anything if we detect an invalid charset. It also has the added benefit of falling back to the http header charset instead of the meta charset if the meta is invalid. Which was the case in Issue YOURLS#3708
2bd1f58 to
4249d73
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a check to make sure that the charset we are getting from the remote response is a valid one.
This will now not convert anything if we detect an invalid charset.
It also has the added benefit of falling back to the http header charset instead of the meta charset if the meta is invalid.
Which was the case in Issue #3708
This also adds some tests to test the
yourls_get_remote_titlefunction to ensure that this fixes #3708 as well as scaffold the tests needed to easily add any other UTF-8 encoding issues with pages.