Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-6501

Incorrect normalization of path of an asset with name beginning with '.'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • None
    • API 2.16.4
    • API
    • None

    Description

      When a new asset named ".jpg" is being modified in JCR, ResourceUtil.normalize() 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.

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

      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.

      Attachments

        Issue Links

          Activity

            People

              cziegeler Carsten Ziegeler
              gaurav17 Gaurav Gupta
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: