This is an automated email from the ASF dual-hosted git repository.

radu pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly.git


The following commit(s) were added to refs/heads/master by this push:
     new 2262199  SLING-8933 - The IncludeRuntimeExtension doesn't correctly 
normalise paths when using the path manipulation options
2262199 is described below

commit 22621998877ff73cf7fe1ceefdbbdc772c9f3d66
Author: Radu Cotescu <[email protected]>
AuthorDate: Fri Dec 20 00:40:45 2019 +0100

    SLING-8933 - The IncludeRuntimeExtension doesn't correctly normalise paths 
when using the path manipulation options
    
    * let Sling do the path normalisation when resolving the servlet relative 
to the current script resource
---
 .../sightly/impl/engine/extension/IncludeRuntimeExtension.java      | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java
 
b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java
index ff81686..6bdc644 100644
--- 
a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java
+++ 
b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/IncludeRuntimeExtension.java
@@ -87,7 +87,7 @@ public class IncludeRuntimeExtension implements 
RuntimeExtension {
             prependPath = StringUtils.EMPTY;
         }
         if (StringUtils.isNotEmpty(prependPath)) {
-            if (!prependPath.endsWith("/")) {
+            if (!prependPath.endsWith("/") && !path.startsWith("/")) {
                 prependPath += "/";
             }
         }
@@ -96,11 +96,11 @@ public class IncludeRuntimeExtension implements 
RuntimeExtension {
             appendPath = StringUtils.EMPTY;
         }
         if (StringUtils.isNotEmpty(appendPath)) {
-            if (!appendPath.startsWith("/")) {
+            if (!appendPath.startsWith("/") && !path.endsWith("/")) {
                 appendPath = "/" + appendPath;
             }
         }
-        return ResourceUtil.normalize(prependPath + path + appendPath);
+        return prependPath + path + appendPath;
     }
 
     private void includeScript(final Bindings bindings, String script, 
PrintWriter out) {

Reply via email to