You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Timothee Maret (JIRA)" <ji...@apache.org> on 2019/08/15 20:58:00 UTC

[jira] [Created] (SLING-8639) VltUtils does not escape path in when creating filter patterns

Timothee Maret created SLING-8639:
-------------------------------------

             Summary: VltUtils does not escape path in when creating filter patterns
                 Key: SLING-8639
                 URL: https://issues.apache.org/jira/browse/SLING-8639
             Project: Sling
          Issue Type: Bug
          Components: Content Distribution
    Affects Versions: Content Distribution Core 0.4.0
            Reporter: Timothee Maret
             Fix For: Content Distribution Core 0.4.2


When distributing a deep content path that includes parenthesis using FileVault, the content package produced does not contain content under that path.

As an example, consider distributing the following path
{code:java}
/content/dam/we-retail/planet(1).jpg{code}
which will yield a content package with the following filter.xml
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
    <filter root="/content/dam/we-retail/planet(1).jpg">
        <include pattern="/content/dam/we-retail/planet(1).jpg"/>
        <include pattern="/content/dam/we-retail/planet(1).jpg/.*"/>
        <exclude pattern="^.*/cq:lastReplicated" matchProperties="true"/>
        <exclude pattern="^.*/cq:lastReplicatedBy" matchProperties="true"/>
        <exclude pattern="^.*/cq:lastReplicationAction" matchProperties="true"/>
    </filter>
</workspaceFilter>
{code}
The include and exclude patterns are treated by FileVault [as regular expression|https://github.com/apache/jackrabbit-filevault/blob/6df76ba4a45316a84ec1cd10636296d191a82260/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/filter/DefaultPathFilter.java#L84].

Thus the {{(1)}} part of the {{/content/dam/we-retail/planet(1).jpg}} and {{/content/dam/we-retail/planet(1).jpg/.*}} patterns is treated as a group rather than literally.

The path should be escaped when building the patterns, in https://github.com/apache/sling-org-apache-sling-distribution-core/blob/3d51ac0b09c9a057b590349727392eaedba26aea/src/main/java/org/apache/sling/distribution/serialization/impl/vlt/VltUtils.java#L84



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)