lukaszlenart opened a new pull request, #1511:
URL: https://github.com/apache/struts/pull/1511

   ## Summary
   
   Backport of bug fix from PR #1510 to Struts 6.x branch.
   
   When a `contentCharSet` expression evaluates to null, the current code 
incorrectly appends `;charset=` with no value to the content-type header, 
resulting in malformed headers like `text/plain;charset=`.
   
   **Changes:**
   - Parse `contentCharSet` expression before checking emptiness (was checking 
raw expression string)
   - Use `StringUtils.isNotEmpty()` for proper null/empty validation
   - Use `setCharacterEncoding()` API instead of string concatenation to 
content-type
   - Add test case for null-evaluating charset expressions
   
   ## Test plan
   
   - [x] `StreamResultTest.testStreamResultWithNullCharSetExpression` - 
verifies null expression doesn't append `;charset=`
   - [x] `StreamResultTest.testStreamResultWithCharSet` - verifies static 
charset still works
   - [x] `StreamResultTest.testStreamResultWithCharSet2` - verifies expression 
returning value still works
   - [x] All 13 tests in `StreamResultTest` pass
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to