[ 
https://issues.apache.org/jira/browse/WW-5602?focusedWorklogId=998599&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-998599
 ]

ASF GitHub Bot logged work on WW-5602:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jan/26 16:50
            Start Date: 04/Jan/26 16:50
    Worklog Time Spent: 10m 
      Work Description: 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)




Issue Time Tracking
-------------------

    Worklog Id:     (was: 998599)
    Time Spent: 40m  (was: 0.5h)

> Can't specify empty charset on StreamResult
> -------------------------------------------
>
>                 Key: WW-5602
>                 URL: https://issues.apache.org/jira/browse/WW-5602
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 6.8.0
>            Reporter: Andrea Vettori
>            Assignee: Lukasz Lenart
>            Priority: Minor
>             Fix For: 6.9.0, 7.2.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> When serving binary files using StreamResult the Content Type header should 
> NOT contain a charset specification.
> If the charset is not specified in the StreamResult, UTF-8 is automatically 
> applied.
> If the charset is specified with an expression, and the expression evaluates 
> to null/empty string, an invalid
> ;charset=
> specification is added to the content-type header on the StreamResult.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to