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

Fix multivalued complex field update when a blob is removed from a subfield

    XMLWordPrintable

    Details

    • Release Notes Summary:
      The REST API handles blob deletion from a multivalued complex field.
    • Release Notes Description:
      Hide

      Behavior on document update through REST has changed around blobs.

      Previously, we we're able to remove a blob with a PUT request on document. This has changed and has the following behavior:

      • if blob is present on top level, it is used to persist it
      • if blob is absent on top level, nothing changed for the blob
      • if blob is stated null like "file:content": null then the blob is removed from document
      • if blob is present inside a list or a complex, it is used to persist it
      • if blob is absent or stated null inside a list or a complex then the blob is removed from document (this is enforced by complex/list update rule doesn't handle partial update)
      Show
      Behavior on document update through REST has changed around blobs. Previously, we we're able to remove a blob with a PUT request on document. This has changed and has the following behavior: if blob is present on top level, it is used to persist it if blob is absent on top level, nothing changed for the blob if blob is stated null like "file:content": null then the blob is removed from document if blob is present inside a list or a complex, it is used to persist it if blob is absent or stated null inside a list or a complex then the blob is removed from document (this is enforced by complex/list update rule doesn't handle partial update)
    • Backlog priority:
      700
    • Sprint:
      nxcore 11.1.10
    • Story Points:
      3

      Description

      Steps to reproduce

      1. Define a document type with a multivalued complex field with 2 subfields:
        • fichier: Blob
        • name: String
      2. Deploy to Nuxeo
      3. Create a document with this type and set 2 values for the complex field
      4. Edit the document and remove the blob for the first element of the complex field. Save
      5. Observe the document was not updated
        The corresponding payload for the request is almost empty
        {"entity-type":"document","uid":"7ff88b98-4263-4927-9cd7-2a85cb1fa748","properties":{}}
        
      6. Edit the document, remove the blob for the first element of the complex field and also change the String field. Save
      7. Observe only the String subfield has been updated
        The corresponding payload for the request is
        {
          "entity-type": "document",
          "uid": "7ff88b98-4263-4927-9cd7-2a85cb1fa748",
          "properties": {
            "complexmulti:complexe": [
              {
                "fichier": {
                  "name": "SimpleTable.xlsx",
                  "mime-type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
                  "encoding": null,
                  "digestAlgorithm": "MD5",
                  "digest": "cfb77b8e91627e7c5006e75ce9b8dc20",
                  "length": "6056",
                  "data": "http://localhost:8080/nuxeo/nxfile/default/7ff88b98-4263-4927-9cd7-2a85cb1fa748/complexmulti:complexe/0/fichier/SimpleTable.xlsx?changeToken=13-0",
                  "appLinks": []
                },
                "name": "fichier2"
              },
              {
                "fichier": null,
                "name": "fichier7"
              }
            ]
          }
        } 
        

      Expected behavior: the blob must be removed from the complex field

      It's interesting to note that the null value does not remove the blob from the property
      => there may be 2 distinct bugs here.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 6 hours
                  6h