Lukasz Lenart created WW-5866:
---------------------------------
Summary: 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
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)