This issue has been created
There is 1 update.
 
 
XWiki Platform / cid:jira-generated-image-avatar-5e03cae1-5a7a-4997-a57e-876601214ae0 XWIKI-22751 Open

Escaping of page references won't work in documentTree macro

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-8e439d49-8ff6-4314-b1aa-4416950e6299 Christian Fröhlich created this issue on 02/Jan/25 19:18
 
Summary: Escaping of page references won't work in documentTree macro
Issue Type: cid:jira-generated-image-avatar-5e03cae1-5a7a-4997-a57e-876601214ae0 Bug
Affects Versions: 16.2.0
Assignee: Unassigned
Components: Component
Created: 02/Jan/25 19:18
Environment: Windows 11, Ubuntu 22
Priority: cid:jira-generated-image-static-major-b8e2ee06-2b3f-473e-b3ea-e4ee6084bb67 Major
Reporter: Christian Fröhlich
Description:

I tried to exclude some pages in the Navigation and created my own Panel. Added the Following code to the default Navigation Panel:

 

```

    1. Exclude all pages below tag "hiddenSubpages"
      #set($hiddenSubpages = $services.query.xwql("from doc.object(XWiki.TagClass) as tag where 'hiddenSubpages' member of tag.tags").execute())
      #foreach($hiddenSubpage in $hiddenSubpages)
        #set ($hiddenSubpageWildCard = $hiddenSubpage.replaceAll(".WebHome$", ".%"))
        #set($children = $services.query.xwql("where doc.fullName like :name").bindValue("name", $hiddenSubpageWildCard).execute())
        #foreach($child in $children)
          #if($child != $hiddenSubpage)
            #set ($discard = $exclusions.add("document:" + $child.replaceAll(",", "
      ,"))))
          #end
        #end
      #end

```

I tested it with the replace of "
.", "\," "%2C" and without replace. In all versions of the macro, Pages with a comma are not filtered.

 
 

1 update

 
cid:jira-generated-image-avatar-8e439d49-8ff6-4314-b1aa-4416950e6299 Changes by Christian Fröhlich on 02/Jan/25 19:21
 
Description: I tried to exclude some pages in the Navigation and created my own Panel. Added the Following code to the default Navigation Panel:
{code:java}
 

```

## Exclude all pages below tag "hiddenSubpages"
#set($hiddenSubpages = $services.query.xwql("from doc.object(XWiki.TagClass) as tag where 'hiddenSubpages' member of tag.tags").execute())
#foreach($hiddenSubpage in $hiddenSubpages)
  #set ($hiddenSubpageWildCard = $hiddenSubpage.replaceAll(".WebHome$", ".%"))
  #set($children = $services.query.xwql("where doc.fullName like :name").bindValue("name", $hiddenSubpageWildCard).execute())
  #foreach($child in $children)
    #if($child != $hiddenSubpage)
      #set ($discard = $exclusions.add("document:" + $child.replaceAll(",", "\\,"))))
    #end
  #end
#end
  {code}
```

I tested it with the replace of "\\ \\ .", "\," "%2C" and without replace. In all versions of the macro, Pages with a comma are not filtered.