Skip to content

Fix error when trying to persist non-utf-8 title#2569

Merged
acelaya merged 1 commit intoshlinkio:developfrom
acelaya-forks:charset-error
Jan 9, 2026
Merged

Fix error when trying to persist non-utf-8 title#2569
acelaya merged 1 commit intoshlinkio:developfrom
acelaya-forks:charset-error

Conversation

@acelaya
Copy link
Member

@acelaya acelaya commented Jan 9, 2026

Closes #2564

Improve charset parsing of auto-resolved titles so that:

  1. If the Website's Content-Type header does not include the charset, we fall back to <meta charset> or <meta http-equiv="Content-Type"> tags.
  2. If it's still not possible to determine the charset, we ignore the auto-resolved title entirely, to avoid encoding errors when the value is persisted.

Up until now, we would try to persist an un-parsed title, which causes an error if it is not utf-8.

@acelaya acelaya merged commit 690b5c8 into shlinkio:develop Jan 9, 2026
21 checks passed
@acelaya acelaya deleted the charset-error branch January 9, 2026 16:12
@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 90.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.59%. Comparing base (9641c70) to head (8a82361).
⚠️ Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
.../ShortUrl/Helper/ShortUrlTitleResolutionHelper.php 90.00% 2 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2569      +/-   ##
=============================================
- Coverage      94.61%   94.59%   -0.03%     
- Complexity      1637     1641       +4     
=============================================
  Files            273      273              
  Lines           5111     5124      +13     
=============================================
+ Hits            4836     4847      +11     
- Misses           275      277       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

500 error returned when shortening website with title in Japanese

1 participant