Skip to content

Use decodeUtf8' instead of throwing - #84

Merged
ysangkok merged 2 commits into
masterfrom
no-exception-utf8
Sep 22, 2026
Merged

ysangkok merged 2 commits into
masterfrom
no-exception-utf8

Conversation

@ysangkok

@ysangkok ysangkok commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

HTML forms do not use UTF8 per default, so they could crash the
server when submitting certain non-ASCII filenames.
The cause is decodeUtf8, which throws an exception when an invalid UTF8 input is provided.

After this the change to decodeUtf8', even unread inputs/files are validated. This means
that there could be users that had previously working code with ignored
files, that now fails validation. These users should specify UTF-8 on
the form, or submit a PR to implement support for non-UTF8 encodings.

@ysangkok
ysangkok requested a review from a team September 21, 2026 20:49
@ysangkok

Copy link
Copy Markdown
Contributor Author

@fpringle please have a look

@fpringle fpringle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good! Can we add some documentation explaining that non-UTF8 form submissions will be rejected when Lenient is not used?

English locales use windows-1252 per default, so they could crash the
Server when submitting certain non-ASCII filenames.

After this change, even unread inputs/files are validated. This means
that there could be users that had previously working code with ignored
files, that now fails validation. These users should specify UTF-8 on
the form, or submit a PR to implement support for non-UTF8 encodings.
@ysangkok
ysangkok merged commit b144a84 into master Sep 22, 2026
5 checks passed
@ysangkok
ysangkok deleted the no-exception-utf8 branch September 22, 2026 16:22
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.

3 participants