aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver/src/main/java/org/sonar
diff options
context:
space:
mode:
authorJulien Camus <julien.camus@sonarsource.com>2024-12-19 14:14:10 +0100
committersonartech <sonartech@sonarsource.com>2024-12-19 20:03:04 +0000
commit8fe712960e07591f6cc2f8aa2e164a6eb9ad67fa (patch)
tree2dc4a7534b311092542ebacdbd22af13c47b823e /server/sonar-webserver/src/main/java/org/sonar
parent1b2aa4e56280456d456ef960671423f543dba283 (diff)
downloadsonarqube-8fe712960e07591f6cc2f8aa2e164a6eb9ad67fa.tar.gz
sonarqube-8fe712960e07591f6cc2f8aa2e164a6eb9ad67fa.zip
SONAR-23990 Replace with text block
Diffstat (limited to 'server/sonar-webserver/src/main/java/org/sonar')
-rw-r--r--server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CspFilter.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CspFilter.java b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CspFilter.java
index c1095228fbf..a8a3d2c7454 100644
--- a/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CspFilter.java
+++ b/server/sonar-webserver/src/main/java/org/sonar/server/platform/web/CspFilter.java
@@ -74,11 +74,13 @@ public class CspFilter implements Filter {
private static String getAssetsPathScriptCSPHash(String contextPath) {
final String WEB_CONTEXT_PLACEHOLDER = "WEB_CONTEXT";
- final String ASSETS_PATH_SCRIPT = "\n" +
- " window.__assetsPath = function (filename) {\n" +
- " return 'WEB_CONTEXT/' + filename;\n" +
- " };\n" +
- " ";
+ final String ASSETS_PATH_SCRIPT = """
+
+ window.__assetsPath = function (filename) {
+ return 'WEB_CONTEXT/' + filename;
+ };
+ \
+ """;
String assetsPathScriptWithContextPath = ASSETS_PATH_SCRIPT.replace(WEB_CONTEXT_PLACEHOLDER, contextPath);
return generateCSPHash(assetsPathScriptWithContextPath);