alfresco-js-api
alfresco-js-api copied to clipboard
Support custom content type on fileUpload
Type of issue: (check with "[x]")
- [ ] New feature request
- [x ] Bug
- [ ] Support request
Current behavior: use the uploadFile method and set the nodeType to a custom created content type. The new document/file will have the default cm:document as a content type
Expected behavior: the custom content type is used instead of the default one
Steps to reproduce the issue: Create a custom content type derived from cm:document in your test environment. Then use uploadFile and set the nodeType to the custom created one.
Node version (for build issues):
New feature request:
You can use formData to post your custom content :
const result = await this.nodesApi.createNode(
object.parentNodeId,
{
name: object.name,
nodeType: object.nodeType,
},
{ autoRename: false },
{
filedata: createReadStream(object.file.path),
name: object.name,
nodeType: object.nodeType,
}
);
It's still an issue as nodeBodyCreate is ignored when createNode use multipart:form-data
You can override nodeType via nodeBody param: https://github.com/Alfresco/alfresco-js-api/blob/a55266731bc31903e38a8ab9885c4739d884a2d3/src/api/content-custom-api/api/upload.api.ts#L33