You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Satya Deep Maheshwari (JIRA)" <ji...@apache.org> on 2017/10/30 12:45:00 UTC

[jira] [Commented] (SLING-6501) Incorrect normalization of path of an asset with name beginning with '.'

    [ https://issues.apache.org/jira/browse/SLING-6501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16224852#comment-16224852 ] 

Satya Deep Maheshwari commented on SLING-6501:
----------------------------------------------

Here's a suggested patch for resolving this problem: https://github.com/apache/sling-org-apache-sling-api/compare/master...sdmcraft:SLING-6501?expand=1
[~cziegeler] , [~ianeboston], could you please review?

> 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)