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

Auto versioning snapshots empty_picture.png instead uploaded file

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Automation

      Description

      With auto versioning enabled on documents with Picture facet and beforeUpdate="false" on the VersioningService policy definition, the temporary placeholder empty_picture.png is processed in the version snapshot instead of the actual uploaded file. 

      With the contribution below, a minor version is created when a document is created and each time the main file is replaced. When you create a document and then replace the file, the version becomes 0.2. When selecting to view version 0.1, the empty_picture.png is shown instead of the initial version of the file. This pattern recurs for version 0.3 and viewing 0.2, etc.

      We believe this can be corrected by treating the presence of the empty_picture.png as effectively the same as empty, 0 byte or null.  

      This behavior may have been introduced by NXP-30526, which avoids regenerating already computed picture views.

       

       

       

      <?xml version="1.0"?>
      <component name="com.lululemon.versioning.service.contrib">
      
          <require>org.nuxeo.ecm.core.versioning.default-policies</require>
      
          <extension target="org.nuxeo.ecm.core.api.versioning.VersioningService" point="policies">
              <policy id="document-created-auto-minor-version" increment="MINOR" beforeUpdate="false" order="20">
                  <filter-id>document-created-filter</filter-id>
              </policy>
              <policy id="file-content-changed-minor-version" increment="MINOR" beforeUpdate="false" order="21">
                  <!-- PDA-247 - Only create minor version on change when change is not from nuxeo drive src
                  and file updates -->
                  <filter-id>file-content-updated-filter</filter-id>
              </policy>
          </extension>
      
          <extension target="org.nuxeo.ecm.core.api.versioning.VersioningService" point="filters">
              <filter id="file-content-updated-filter">
                  <!-- Cover conditions when file changes AND when a new file is added without a previous
                  one existing already -->
                  <condition>
                      #{
                          currentDocument.contextData.source != "drive" and (
                              (previousDocument.file.content == null and currentDocument.file.content != null) or
                              (previousDocument.file.content.digest != currentDocument.file.content.digest)
                          )
                      }
                  </condition>
              </filter>
              <filter id="document-created-filter">
                  <!-- Cover conditions when file changes AND when a new file is added without a previous
                  one existing already -->
                  <condition>
                      #{previousDocument == null and currentDocument != null}
                  </condition>
              </filter>
          </extension>
      
      </component>
       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                bbaron Bruce Baron
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: