This is an automated email from the ASF dual-hosted git repository. tmaret pushed a commit to branch SLING-10088-wk in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-core.git
commit c2f1e1c64e9353f64fd07239c326b454ec15070a Author: tmaret <[email protected]> AuthorDate: Sun Jan 31 03:47:41 2021 +0100 SLING-10088 - do not escape the root slash --- .../serialization/impl/vlt/VltUtils.java | 22 +++++++++++++++++++++- 1 file changed, 21 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..dfc501f 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); @@ -447,4 +447,24 @@ public class VltUtils { return result; } + + private static String quote(String path) { + + /* + * As a workaround for JCRVLT-500, + * we escape all but the root slash. + * + * See also SLING-10088 + */ + + if (path == null) { + return null; + } else if (path.startsWith("/")) { + return "/" + Pattern.quote(path.substring(1)); + } else { + return Pattern.quote(path); + } + + } + }
