-
Type: Bug
-
Status: Resolved
-
Priority: Blocker
-
Resolution: Fixed
-
Affects Version/s: 9.10
-
Component/s: Automation, Core IO
Sending a PUT request with a payload which tries to update a BlobList property will remove some of the blobs if the payload contains less values than the property.
Steps to reproduce
- Create a File document
- Attach 3 files to the attachments (files:files metadata). The resulting JSON is
{ "entity-type": "document", "repository": "default", "uid": "a5aba8bc-d3d2-4500-884d-1cd388cc799b", "path": "/default-domain/UserWorkspaces/Administrator/File", "type": "File", "state": "project", "parentRef": "a4071fa3-5335-4daa-8833-a895c53c1ce1", "isCheckedOut": true, "isVersion": false, "isProxy": false, "changeToken": "34-0", "title": "File", "lastModified": "2018-08-22T08:57:52.736Z", "properties": { "uid:uid": null, "uid:major_version": 0, "uid:minor_version": 0, "thumb:thumbnail": { "name": "attestation.png", "mime-type": "image/png", "encoding": null, "digestAlgorithm": "MD5", "digest": "601a2680ae02481ea717b40f10f9d68f", "length": "5519", "data": "http://nereid2:8080/nuxeo/nxfile/default/a5aba8bc-d3d2-4500-884d-1cd388cc799b/thumb:thumbnail/attestation.png" }, "file:content": { "name": "attestation.doc", "mime-type": "application/msword", "encoding": null, "digestAlgorithm": "MD5", "digest": "a38439b314e9b7a6d32af9391144f65e", "length": "10752", "data": "http://nereid2:8080/nuxeo/nxfile/default/a5aba8bc-d3d2-4500-884d-1cd388cc799b/file:content/attestation.doc" }, "common:icon-expanded": null, "common:icon": "/icons/word.png", "files:files": [ { "file": { "name": "toto0.doc", "mime-type": "application/msword", "encoding": null, "digestAlgorithm": "MD5", "digest": "f34f26891fd8d94c756a366fc0aeb876", "length": "58880", "data": "http://localhost:8080/nuxeo/nxfile/default/a5aba8bc-d3d2-4500-884d-1cd388cc799b/files:files/0/file/toto0.doc" } }, { "file": { "name": "toto1.odt", "mime-type": "application/vnd.oasis.opendocument.text", "encoding": null, "digestAlgorithm": "MD5", "digest": "f2518c4c6b994ce95bb3a150f7ecb1ef", "length": "13716", "data": "http://localhost:8080/nuxeo/nxfile/default/a5aba8bc-d3d2-4500-884d-1cd388cc799b/files:files/2/file/toto1.odt" } }, { "file": { "name": "toto2.doc", "mime-type": "application/msword", "encoding": null, "digestAlgorithm": "MD5", "digest": "a38439b314e9b7a6d32af9391144f65e", "length": "10752", "data": "http://nereid2:8080/nuxeo/nxfile/default/a5aba8bc-d3d2-4500-884d-1cd388cc799b/files:files/3/file/toto2.doc" } } ], "dc:description": null, "dc:language": null, "dc:coverage": null, "dc:valid": null, "dc:creator": "Administrator", "dc:modified": "2018-08-22T08:57:52.736Z", "dc:lastContributor": "Administrator", "dc:rights": null, "dc:expired": null, "dc:format": null, "dc:created": "2018-08-17T12:10:37.717Z", "dc:title": "File", "dc:issued": null, "dc:nature": null, "dc:subjects": [], "dc:contributors": [ "Administrator" ], "dc:source": null, "dc:publisher": null, "relatedtext:relatedtextresources": [] }, "facets": [ "Versionable", "Publishable", "Commentable", "HasRelatedText", "Thumbnail" ] }
- Run the following cURL command after adapting the UUID and the host
curl -X PUT \ http://localhost:8080/nuxeo/api/v1/id/a5aba8bc-d3d2-4500-884d-1cd388cc799b \ -H 'Accept: text/plain,application/json, application/json' \ -H 'Authorization: Basic QWRtaW5pc3RyYXRvcjpBZG1pbmlzdHJhdG9y' \ -H 'Cache-Control: no-cache' \ -H 'Content-Type: application/json' \ -H 'Postman-Token: 67197919-de73-4a15-8635-87c17e23d630' \ -H 'X-NXproperties: *' \ -d '{ "entity-type": "document", "uid": "a5aba8bc-d3d2-4500-884d-1cd388cc799b", "properties": { "files:files": [ { "name": "toto2.doc", "mime-type": "application/msword", "encoding": null, "digestAlgorithm": "MD5", "digest": "a38439b314e9b7a6d32af9391144f65e", "length": "10752", "data": "http://localhost:8080/nuxeo/nxfile/default/a5aba8bc-d3d2-4500-884d-1cd388cc799b/files:files/3/file/toto2.doc" } ] } }'
- Observe that the 2 last attachments have been removed. If the cURL command have had two values for files:files, only the last attachment would have been removed.
The resulting JSON of the previous command is{ "entity-type": "document", "repository": "default", "uid": "a5aba8bc-d3d2-4500-884d-1cd388cc799b", "path": "/default-domain/UserWorkspaces/Administrator/File", "type": "File", "state": "project", "parentRef": "a4071fa3-5335-4daa-8833-a895c53c1ce1", "isCheckedOut": true, "isVersion": false, "isProxy": false, "changeToken": "35-0", "title": "File", "lastModified": "2018-08-22T09:02:06.441Z", "properties": { "uid:uid": null, "uid:major_version": 0, "uid:minor_version": 0, "thumb:thumbnail": { "name": "attestation.png", "mime-type": "image/png", "encoding": null, "digestAlgorithm": "MD5", "digest": "601a2680ae02481ea717b40f10f9d68f", "length": "5519", "data": "http://localhost:8080/nuxeo/nxfile/default/a5aba8bc-d3d2-4500-884d-1cd388cc799b/thumb:thumbnail/attestation.png" }, "file:content": { "name": "attestation.doc", "mime-type": "application/msword", "encoding": null, "digestAlgorithm": "MD5", "digest": "a38439b314e9b7a6d32af9391144f65e", "length": "10752", "data": "http://localhost:8080/nuxeo/nxfile/default/a5aba8bc-d3d2-4500-884d-1cd388cc799b/file:content/attestation.doc" }, "common:icon-expanded": null, "common:icon": "/icons/word.png", "files:files": [ { "file": { "name": "toto0.doc", "mime-type": "application/msword", "encoding": null, "digestAlgorithm": "MD5", "digest": "f34f26891fd8d94c756a366fc0aeb876", "length": "58880", "data": "http://localhost:8080/nuxeo/nxfile/default/a5aba8bc-d3d2-4500-884d-1cd388cc799b/files:files/0/file/toto0.doc" } } ], "dc:description": null, "dc:language": null, "dc:coverage": null, "dc:valid": null, "dc:creator": "Administrator", "dc:modified": "2018-08-22T09:02:06.441Z", "dc:lastContributor": "Administrator", "dc:rights": null, "dc:expired": null, "dc:format": null, "dc:created": "2018-08-17T12:10:37.717Z", "dc:title": "File", "dc:issued": null, "dc:nature": null, "dc:subjects": [], "dc:contributors": [ "Administrator" ], "dc:source": null, "dc:publisher": null, "relatedtext:relatedtextresources": [] }, "facets": [ "Versionable", "Publishable", "Commentable", "HasRelatedText", "Thumbnail" ] }
This behavior may be the consequence of NXP-18488 which sets the property to null when decoding JSON to a BlobProperty where the data starts with http.
Expect result:
It is ok to block the update but not to loose some data
Ideally there should be a way (a third JSONBlobDecoder implementation?) to be able to update a bloblist property.
- is related to
-
ELEMENTS-901 nuxeo-file element nullifies the values if no edit in a workflow
- Resolved
-
NXP-27371 Fix multivalued complex field update when a blob is removed from a subfield
- Resolved
- is required by
-
ELEMENTS-980 Fix nuxeo-file widget in data-table editing
- Resolved