You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by tm...@apache.org on 2021/01/31 02:44:11 UTC

[sling-org-apache-sling-distribution-core] 01/01: SLING-10088 - do not escape the root slash

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

tmaret pushed a commit to branch SLING-10088-fix
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git

commit 1c7560cf5b88b9c7a1f8b024832b88cdfd201873
Author: tmaret <tm...@adobe.com>
AuthorDate: Sun Jan 31 03:43:21 2021 +0100

    SLING-10088 - do not escape the root slash
---
 .../distribution/serialization/impl/vlt/VltUtils.java | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java b/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java
index 0586cfc..b18e62d 100644
--- a/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java
+++ b/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java
@@ -90,7 +90,7 @@ public class VltUtils {
             boolean deep = distributionRequest.isDeep(path);
             PathFilterSet nodeFilterSet = new PathFilterSet(path);
             if (!deep) {
-                nodeFilterSet.addInclude(new DefaultPathFilter(Pattern.quote(path)));
+                nodeFilterSet.addInclude(new DefaultPathFilter(quote(path)));
             }
             initFilterSet(nodeFilterSet, nodeFilters, patterns);
 
@@ -101,6 +101,8 @@ public class VltUtils {
             filter.add(nodeFilterSet, propertyFilterSet);
         }
 
+        log.info("filter: {}", filter);
+
         return filter;
     }
 
@@ -447,4 +449,19 @@ public class VltUtils {
 
         return result;
     }
+
+    private static String quote(String path) {
+
+        // See SLING-10088, JCRVLT-500
+
+        if (path == null) {
+            return null;
+        } else if (path.startsWith("/")) {
+            return "/" + Pattern.quote(path.substring(1));
+        } else {
+            return Pattern.quote(path);
+        }
+
+    }
+
 }