Describe the bug
In my CAP app, I would like to query the content of an attachment programatically as described here. The documentation says:
Note that the binary content field is excluded by default, making the operation lightweight
I try to explicitly return the content of the Attachment via a query like this:
await SELECT.one.from('ExampleEntity.data').columns('content').where({ up__ID: exampleEntity.ID })
This works locally using @cap-js/sqlite, however when deployed and using SAP HANA Cloud + SAP Object Store, the above query always returns null for content as observed when debugging remotely on Kubernetes.
Also when querying via OData like
GET {{baseUrl}}/ExampleEntity({{exampleEntityId}})/data({{dataId}})/content
the content is returned as expected, so it should be populated in the SAP Object Store.
Use Case: I would like provide a download OData action that zips multiple attachments / files together and returns them as a compressed archive instead.
To Reproduce
In the schema.cds:
entity ExampleEntity : cuid, managed {
data : Composition of one Attachments;
}
In some service file:
const exampleEntity = await SELECT.one.from('ExampleEntity').where({ ID: '...' })
// returns { "content": null }
const notWorking = await SELECT.one.from('ExampleEntity.data').columns('content').where({ up__ID: exampleEntity.ID })
// returns { "filename": "...", "mimeType": "..."}
const working = await SELECT.one.from('ExampleEntity.data').where({ up__ID: exampleEntity.ID })
Expected behavior
I expect content to be returned as Stream.Readable or Buffer instead of being null.
Since this is an initial implementation, I am not aware if this ever worked in the past. So maybe this is not even a bug but an unsupported feature.
Describe the bug
In my CAP app, I would like to query the content of an attachment programatically as described here. The documentation says:
I try to explicitly return the content of the Attachment via a query like this:
This works locally using
@cap-js/sqlite, however when deployed and using SAP HANA Cloud + SAP Object Store, the above query always returnsnullfor content as observed when debugging remotely on Kubernetes.Also when querying via OData like
the content is returned as expected, so it should be populated in the SAP Object Store.
Use Case: I would like provide a download OData action that zips multiple attachments / files together and returns them as a compressed archive instead.
To Reproduce
In the
schema.cds:In some service file:
Expected behavior
I expect content to be returned as
Stream.ReadableorBufferinstead of beingnull.Since this is an initial implementation, I am not aware if this ever worked in the past. So maybe this is not even a bug but an unsupported feature.