solomax commented on a change in pull request #376: WICKET-6682 add CSP nonce
support: initial commit
URL: https://github.com/apache/wicket/pull/376#discussion_r302990094
##########
File path:
wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java
##########
@@ -119,27 +151,33 @@ public static void writeLinkUrl(final Response response,
final CharSequence url,
public static void writeLinkUrl(final Response response, final
CharSequence url,
final CharSequence media, final String markupId, final String
rel)
{
- response.write("<link rel=\"stylesheet\" type=\"text/css\"
href=\"");
- response.write(Strings.escapeMarkup(url));
- response.write("\"");
- if (Strings.isEmpty(media) == false)
+ HeaderItemAttributeMap attributes = new
HeaderItemAttributeMap();
+
+ if (Strings.isEmpty(rel) == false)
{
- response.write(" media=\"");
- response.write(Strings.escapeMarkup(media));
- response.write("\"");
+ attributes.add(HeaderItemAttribute.LINK_REL, rel);
+ } else {
Review comment:
looks like the place for ternary operator ...
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services