[
https://issues.apache.org/jira/browse/SLING-6501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16225192#comment-16225192
]
ASF GitHub Bot commented on SLING-6501:
---------------------------------------
sdmcraft opened a new pull request #1: SLING-6501:Incorrect normalization of
path of an asset with name begi…
URL: https://github.com/apache/sling-org-apache-sling-api/pull/1
…nning with '.'
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Incorrect normalization of path of an asset with name beginning with '.'
> ------------------------------------------------------------------------
>
> Key: SLING-6501
> URL: https://issues.apache.org/jira/browse/SLING-6501
> Project: Sling
> Issue Type: Bug
> Components: API
> Reporter: Gaurav Gupta
> Priority: Critical
> Fix For: API 2.16.4
>
>
> When a new asset named ".jpg" is being modified in JCR,
> [ResourceUtil.normalize()|https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceUtil.html#normalize-java.lang.String-]
> method returns an incorrect normalized path which leads to the creation of a
> folder named '.jp' under the same parent node. A small test shows this
> anomaly.
> {code:java}
> public class RUNormalizeTest {
> public static String toPropertyPath(String paramName, String path) {
> if (!paramName.startsWith("/")) {
> paramName = ResourceUtil.normalize(path + '/' + paramName);
> }
> return paramName;
> }
>
> public static void main(String[] args) {
> String pName =
> "./jpg_folder/.jpg/jcr:content/metadata/dc:title";
> String path = "/content/dam";
> System.out.println(toPropertyPath(pName,path));
> }
> }
> {code}
> Expected output: /content/dam/jpg_folder/.jpg/jcr:content/metadata/dc:title
> Output: /content/dam/jpg_folder/.jp/jcr:content/metadata/dc:title
> In the above code, the properties of an asset named '.jpg' are being
> modified. However, the normalize method returns an incorrect path for the
> input path.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)