Skip to content

Ignore invalid RFC 2231 extended value so it cannot erase a valid filename (1.x)#480

Open
alhudz wants to merge 1 commit into
apache:1.xfrom
alhudz:rfc2231-invalid-ext-value-1.x
Open

Ignore invalid RFC 2231 extended value so it cannot erase a valid filename (1.x)#480
alhudz wants to merge 1 commit into
apache:1.xfrom
alhudz:rfc2231-invalid-ext-value-1.x

Conversation

@alhudz

@alhudz alhudz commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Port of #479 to the 1.x branch, as requested there. The 1.x ParameterParser.parse has the same pattern: an IllegalArgumentException from the RFC 2231 decode sets paramValue = null and the parameter is still stored, so a malformed filename* clobbers a valid filename after stripDelimiter.

Repro: parse("form-data; name=\"file\"; filename=\"safe.txt\"; filename*=UTF-8''bad%2", new char[]{',',';'}). Expected: filename stays safe.txt. Actual on unpatched 1.x: filename is null (the new test fails with expected: <safe.txt> but was: <null>).

Same fix as #479, adapted to 1.x (no var): flag the invalid decode and skip storing that parameter. Includes the same regression test; full 1.x suite passes (87 tests) and checkstyle is clean.

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.

1 participant