Details
-
Bug
-
Resolution: Done
-
Major
-
3.9.0
-
3
-
Yes
Description
Trying to create a regular expression that disallows access to paths starting with "/com/foo/bar/".
This doesn't work:
path =~ "(?!^/com/foo/bar/.*).*"
And this does:
path =~ "(?!^com/foo/bar/.*).*"
However, for positive regular expressions...
This doesn't work:
path =~ "^/com/foo/bar/.*"
But this does work:
path =~ "^com/foo/bar/.*"
So that's at least consistent, but doesn't line up with our documentation at all, which states that:
When writing a content selector, remember that the asset’s path will always begin with a leading slash when the selector is evaluated. This is true even though the leading slash is not displayed when searching or browsing assets.
The above is the way it was supposed to work based on fixes done in ---- and --NEXUS-11632--.NEXUS-15545
For positive regular expressions things are also quite odd, but in a slightly different way.
This works:
path =~ "/com/foo/bar/.*"
As does this:
path =~ "com/foo/bar/.*"
This doesn't work:
path =~ "^/com/foo/bar/.*"
But this does work:
path =~ "^com/foo/bar/.*"
Expected
Content selectors that use regular expressions should require that paths start with "/". And using a leading "^" should be optional. That is the way Nexus 2.x works, so this is required for compatibility when upgrading.
Update 4/2/18
For upload this is needed:
path =~ "/com/foo/bar/.*"
So to make both upload and download work you need:
path =~ "/?com/foo/bar/.*"
Attachments
Issue Links
- is related to
-
NEXUS-11632 Content selector preview not handling leading slash properly
-
- Closed
-
-
NEXUS-15545 Tree view does not work properly with content selectors
-
- Closed
-
- testing discovered
-
NEXUS-18509 Make JEXL and CSEL behave the same for expressions without a leading slash
-
- Done
-
- mentioned in
-
Page Loading...