Enonic version: Linux
OS: 6.12.0
Hi !
I found strange issue with attachments in content objects. We have a service to create or update content objects in Enonic by POST requests. And it doesn’t work for objects that have attachment. In this example PDF file. During update process script updates only changed attributes in “data” sub-object.
Please check this part of code:
var updatedObjectData = …;
var currentObject = …;
result = libs.content.modify({
key: objectID,
editor: profileEditor,
branch: ‘draft’
});
function profileEditor( c ) {
c.data = currentObject.data;
for( var key in updatedObjectData ) {
c.data[key] = updatedObjectData[key];
}
return c;
}
And during this action script returns an exception:
Value of type [java.lang.String] cannot be converted to [Reference]: NodeId format incorrect: myfile.pdf
It seems that Enonic thinks that attachments should be stored as a reference with nodeID. But in our case attachments are inline.
How we can fix this issue ?
Thanks !