Skip to content

Fix handling of invalid charsets on remote sites#4007

Merged
LeoColomb merged 2 commits intoYOURLS:masterfrom
matt-h:fix/3708-handle-invalid-charsets
Oct 28, 2025
Merged

Fix handling of invalid charsets on remote sites#4007
LeoColomb merged 2 commits intoYOURLS:masterfrom
matt-h:fix/3708-handle-invalid-charsets

Conversation

@matt-h
Copy link
Copy Markdown
Contributor

@matt-h matt-h commented Oct 24, 2025

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_title function to ensure that this fixes #3708 as well as scaffold the tests needed to easily add any other UTF-8 encoding issues with pages.

@ozh
Copy link
Copy Markdown
Member

ozh commented Oct 24, 2025

What a sexy PR. Fix issue, add tests. ❤️

Copy link
Copy Markdown
Member

@LeoColomb LeoColomb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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
@LeoColomb LeoColomb force-pushed the fix/3708-handle-invalid-charsets branch from 2bd1f58 to 4249d73 Compare October 28, 2025 14:56
@LeoColomb LeoColomb changed the title Fix handling of invalid charsets on remote sites. Fix handling of invalid charsets on remote sites Oct 28, 2025
@LeoColomb LeoColomb enabled auto-merge (squash) October 28, 2025 14:56
@LeoColomb LeoColomb merged commit c21c012 into YOURLS:master Oct 28, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid <meta charset> causes fatal error in title fetch

3 participants