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

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

                Author: ASF GitHub Bot
            Created on: 24/Nov/26 14:19
            Start Date: 24/Nov/26 14:19
    Worklog Time Spent: 10m 
      Work Description: ciphertrail-x opened a new pull request, #2163:
URL: https://github.com/apache/struts/pull/2163

   Fixes [WW-5866](https://issues.apache.org/jira/browse/WW-5866).
   
   Percent-encode WebJar file names as UTF-8 when generating a URL. For 
example, `theme;dark.css` now produces a URL ending in `theme%3Bdark.css`, 
while the classpath lookup still uses `theme;dark.css`. Directory separators 
and literal `+` characters are preserved.
   
   The regression tests cover URL generation, both writer and `var` output, and 
classpath lookup. The semicolon test decodes the generated URI, passes the path 
to the Struts static content loader, and compares the response bytes with the 
CSS fixture. This test exercises the loader directly.
   
   On JDK 17 and Maven 3.10.0, the root `mvn -DskipAssembly verify` run passed 
all 30 modules: 5,271 Surefire tests and 60 Failsafe tests, with zero failures, 
errors, or skips. An earlier root `mvn -DskipAssembly test` run stopped during 
Tiles compilation. The same failure reproduced on the unmodified base commit.
   
   Thanks to Yu Deshui (于得水) for reporting the issue. OpenAI Codex assisted 
with the implementation, tests, and documentation.




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

            Worklog Id:     (was: 1056871)
    Remaining Estimate: 0h
            Time Spent: 10m

> webjar tag: encode the resolved URL before writing it
> -----------------------------------------------------
>
>                 Key: WW-5866
>                 URL: https://issues.apache.org/jira/browse/WW-5866
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core Tags
>            Reporter: Lukasz Lenart
>            Priority: Major
>             Fix For: 7.6.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The {{webjar}} tag (WW-5640) resolves a version-less WebJar path to a 
> servable URL and writes it to the page, or stores it under {{var}}.
> {{StrutsWebJarUrlProvider.resolveUrl}} builds that URL by concatenating the 
> context path, the static content path, the WebJar version and the file path 
> taken from the tag's {{path}} attribute. The file path is appended as given: 
> characters that are not valid in a URL path are not percent-encoded, and 
> {{WebJar.end}} writes the result without further encoding.
> The tag is documented for use inside an attribute of a {{link}} or {{script}} 
> element, so its output should be a well-formed URL whatever the {{path}} 
> attribute contains. The {{script}} and {{link}} tags already encode the 
> {{src}} and {{href}} values they render.
> Proposed change:
> * percent-encode the segments of the file path when the URL is built in 
> {{StrutsWebJarUrlProvider.resolveUrl}}
> * add cases to {{StrutsWebJarUrlProviderTest}} and {{WebJarTest}} for a path 
> with characters outside the URL path set
> Reported by Yu Deshui (于得水), (@qiushui\_sky).



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to