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

Fix update of multi-valued blob property with REST API

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 9.10
    • Fix Version/s: 9.10-HF07, 10.2
    • Component/s: Core
    • Release Notes Summary:
      Multi-valued blob property can be updated via REST API.
    • Backlog priority:
      700
    • Sprint:
      nxcore 10.2.3
    • Story Points:
      5

      Description

      The problem can be reproduced by using this curl command, even if no blob has been previously uploaded using the batch API.
      After running

      curl 'http://localhost:8080/nuxeo/api/v1/path/default-domain/UserWorkspaces/Administrator?' -u Administrator:Administrator -H 'X-NXenrichers.document: permissions, subtypes'  -H 'nx_es_sync: true' -H 'enrichers-document: permissions, subtypes'  -H 'Content-Type: application/json' -H 'accept: text/plain,application/json, application/json' -H 'X-NXDocumentProperties: *' -H 'Nuxeo-Transaction-Timeout: 30000' --data-binary '{"entity-type":"document","type":"File","name":"QSDQSD","properties":{"dc:title":"QSDQSD","dc:description":"","files:files":[{"upload-batch":"batchId-055878bb-4458-48c1-b51b-086e02254b20","upload-fileId":"0"}]},"parentRef":"4c6504ef-bff8-48ee-a4bf-4a0f4109bce1"}'
      

      the following error is thrown

      11:13:25,002 WARN  [WebEngineExceptionMapper] Exception in JAX-RS processing
      org.nuxeo.ecm.core.api.model.PropertyNotFoundException: segment 0 cannot be resolved, files/0/file
      	at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.getProperty(DocumentModelImpl.java:1390)
      	at org.nuxeo.ecm.core.api.impl.DocumentModelImpl.getPropertyValue(DocumentModelImpl.java:1440)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.avoidBlobUpdate(DocumentModelJsonReader.java:164)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.avoidBlobUpdate(DocumentModelJsonReader.java:171)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.avoidBlobUpdate(DocumentModelJsonReader.java:177)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.avoidBlobUpdate(DocumentModelJsonReader.java:155)
      	at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.applyPropertyValues(DocumentModelJsonReader.java:183)
      	at org.nuxeo.ecm.restapi.server.jaxrs.JSONDocumentObject.doPost(JSONDocumentObject.java:99)
      

      It seems that the documentPart which corresponds to the ListProperty is not "correctly" initialized or cannot be iterated by giving an index.

      This prevents from updating a multi-valued blob property.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours
                3h