[
https://issues.apache.org/jira/browse/SLING-6501?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Carsten Ziegeler resolved SLING-6501.
-------------------------------------
Resolution: Fixed
Thanks for the patch , [~satyadeep]. It's applied
> 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
> Assignee: Carsten Ziegeler
> 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)