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

ContentLoader.binaryFile() and ContentLoader.binaryResource() should try to derive mimetype from classpath resource rather than from target resource name

    XMLWordPrintableJSON

Details

    Description

      Currently the ContentLoader.binaryFile tries to derive the mime type from the target resource name which should contain the binary (https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java#L226). This is often useless, as the resource name almost never contains an extension from which a mimetype could be derived (very often a generic name like "file" is used). Instead the first argument (namely classpathResource should be taken as basis to derive the mime type from).
      Currently in practically all cases the mime type will be set to the default value (https://github.com/apache/sling/blob/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/loader/ContentLoader.java#L466) which is application/octet-stream.

      Attachments

        1. SLING-6976-v01.patch
          3 kB
          Konrad Windszus
        2. SLING-6976-v02.patch
          5 kB
          Konrad Windszus

        Activity

          People

            sseifert Stefan Seifert
            kwin Konrad Windszus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: