Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-32042

Add support for ZIP generated with 7-zip and including files whose name contains special characters

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2023.7, 2021.49
    • Component/s: Preview
    • Release Notes Summary:
      A Zip decoding charset fallback mechanism can now be contributed.
    • Backlog priority:
      600
    • Upgrade notes:
      Hide

      A fallback charset can be configured. This is being documented in nxdoc/preview.
      But here is the TL;DR:

      <?xml version="1.0"?>
      <component name="org.nuxeo.ecm.zip.file.reader.fallback.config">
        <extension target="org.nuxeo.runtime.ConfigurationService" point="configuration">
          <property name="org.nuxeo.ecm.zip.file.reader.charset.fallback">cp850</property>
        </extension>
      </component>
      
      Show
      A fallback charset can be configured. This is being documented in nxdoc/preview. But here is the TL;DR: <?xml version= "1.0" ?> <component name= "org.nuxeo.ecm.zip.file.reader.fallback.config" > <extension target= "org.nuxeo.runtime.ConfigurationService" point= "configuration" > <property name= "org.nuxeo.ecm.zip.file.reader.charset.fallback" > cp850 </property> </extension> </component>
    • Sprint:
      nxplatform #103, nxplatform #104
    • Story Points:
      5

      Description

      Steps to reproduce

      1. create a new File document by importing the ZIP archive "CRIPS test.zip" (see first comment)
      2. observe that the preview is not displayed
      3. in the logs there is an error
        ERROR [WebEngineExceptionMapper] org.nuxeo.ecm.core.api.NuxeoException: java.util.zip.ZipException: invalid CEN header (bad entry name)
        org.nuxeo.ecm.core.api.NuxeoException: java.util.zip.ZipException: invalid CEN header (bad entry name)
        	at org.nuxeo.ecm.platform.convert.plugins.Zip2HtmlConverter.listNamesAndCreateIndex(Zip2HtmlConverter.java:76) ~[nuxeo-platform-convert-2021.4.16.jar:?]
        	at org.nuxeo.ecm.platform.convert.plugins.Zip2HtmlConverter.convert(Zip2HtmlConverter.java:61) ~[nuxeo-platform-convert-2021.4.16.jar:?]
        	at org.nuxeo.ecm.core.convert.service.ConversionServiceImpl.convert(ConversionServiceImpl.java:340) ~[nuxeo-core-convert-2021.7.15.jar:?]
        	at org.nuxeo.ecm.platform.preview.adapter.ZipPreviewer.getPreview(ZipPreviewer.java:74) ~[nuxeo-preview-core-2021.1.19.jar:?]
        ...
        Caused by: java.util.zip.ZipException: invalid CEN header (bad entry name)
        	at java.util.zip.ZipFile$Source.zerror(ZipFile.java:1607) ~[?:?]
        	at java.util.zip.ZipFile$Source.checkUTF8(ZipFile.java:1370) ~[?:?]
        	at java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1570) ~[?:?]
        	at java.util.zip.ZipFile$Source.<init>(ZipFile.java:1308) ~[?:?]
        	at java.util.zip.ZipFile$Source.get(ZipFile.java:1271) ~[?:?]
        	at java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:733) ~[?:?]
        	at java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850) ~[?:?]
        	at java.util.zip.ZipFile.<init>(ZipFile.java:248) ~[?:?]
        	at java.util.zip.ZipFile.<init>(ZipFile.java:177) ~[?:?]
        	at java.util.zip.ZipFile.<init>(ZipFile.java:191) ~[?:?]
        	at org.nuxeo.ecm.platform.convert.plugins.Zip2HtmlConverter.listNamesAndCreateIndex(Zip2HtmlConverter.java:73) ~[nuxeo-platform-convert-2021.4.16.jar:?]
        	... 126 more
        

      The error seems to be related to the default encoding used to open the ZIP archive (UTF-8)

      By using the CP850 encoding, the ZIP file is correctly opened and its content is correctly listed (the accents are well displayed)

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: