Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 404 for non-admin when requesting versioned resources. #42

Merged
merged 1 commit into from Oct 30, 2015
Merged

Fix 404 for non-admin when requesting versioned resources. #42

merged 1 commit into from Oct 30, 2015

Conversation

whikloj
Copy link
Member

@whikloj whikloj commented Oct 30, 2015

Addresses FCREPO-1760

Changed Path.getString() to Path.toString()
Added integration test

Changed Path.getString() to Path.toString()
Added integration test
@whikloj
Copy link
Member Author

whikloj commented Oct 30, 2015

@awoods: This seems to work due to default encoding in the modeshape jcr Path class.

From the API
"Because of this encoding and decoding issue, there is no standard representation of a path as a string. Instead, this class uses text encoders to escape certain characters when writing to a string or unescaping the string representation. These encoders and used only with individual segments, and therefore are not used to encode the delimiter. Three standard encoders are provided, although others can certainly be used:"

Our default encoder is org.modeshape.common.text.Jsr283Encoder
"an encoder and decoder that is compliant with JSR-283 by converting the reserved characters (namely '*', '/', ':', '[', ']' and '|') to their unicode equivalent."

If I put the statements

LOGGER.debug("findRolesForPath getString: {}", absPath.getString());
LOGGER.debug("findRolesForPath toString: {}", absPath.toString());
LOGGER.debug("findRolesForPath No encoder: {}", absPath.getString(Path.NO_OP_ENCODER));

I get the results.

DEBUG 11:33:01.997 (WebACRolesProvider) findRolesForPath getString: /{httpwww.jcp.orgjcr1.0}system/{httpwww.jcp.orgjcr1.0}versionStorage/{}e1/{}af/{}50/{}e1af507231ebb2b25964bc53badfd3a0bef96f58/{}1.0
DEBUG 11:33:01.997 (WebACRolesProvider) findRolesForPath toString: /{http://www.jcp.org/jcr/1.0}system/{http://www.jcp.org/jcr/1.0}versionStorage/{}e1/{}af/{}50/{}e1af507231ebb2b25964bc53badfd3a0bef96f58/{}1.0
DEBUG 11:33:01.998 (WebACRolesProvider) findRolesForPath No encoder: /{http://www.jcp.org/jcr/1.0}system/{http://www.jcp.org/jcr/1.0}versionStorage/{}e1/{}af/{}50/{}e1af507231ebb2b25964bc53badfd3a0bef96f58/{}1.0

So if you prefer I can change the toString to getString with the NO_OP_ENCODER.

awoods pushed a commit that referenced this pull request Oct 30, 2015
Fix 404 for non-admin when requesting versioned resources.
@awoods awoods merged commit fa718f2 into fcrepo4:master Oct 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants