From 8efc27aecd17822a911d4c258f553b66447b2745 Mon Sep 17 00:00:00 2001 From: ioleo Date: Wed, 13 Sep 2023 11:35:52 +0100 Subject: [PATCH] Update StylingPolicy.java Fix #187 --- src/main/java/org/owasp/html/StylingPolicy.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/owasp/html/StylingPolicy.java b/src/main/java/org/owasp/html/StylingPolicy.java index 370bf209..b601f903 100644 --- a/src/main/java/org/owasp/html/StylingPolicy.java +++ b/src/main/java/org/owasp/html/StylingPolicy.java @@ -93,13 +93,11 @@ private void closeQuotedIdents() { } private void sanitizeAndAppendUrl(String urlContent) { - if (urlContent.length() < 1024) { - String rewrittenUrl = urlRewriter.apply(urlContent); - if (rewrittenUrl != null && !rewrittenUrl.isEmpty()) { - if (hasTokens) { sanitizedCss.append(' '); } - sanitizedCss.append("url('").append(rewrittenUrl).append("')"); - hasTokens = true; - } + String rewrittenUrl = urlRewriter.apply(urlContent); + if (rewrittenUrl != null && !rewrittenUrl.isEmpty()) { + if (hasTokens) { sanitizedCss.append(' '); } + sanitizedCss.append("url('").append(rewrittenUrl).append("')"); + hasTokens = true; } }