cds-dbs icon indicating copy to clipboard operation
cds-dbs copied to clipboard

@cap-js/hana corrupts the large zip file ( zip files on read gives Corrupted zip or invalid signature)

Open nishnp opened this issue 5 months ago • 2 comments

I am working on a multitenant CAP application the dependencies are as below

pr https://github.com/<your/repo>
@cap-js/asyncapi 1.0.2
@cap-js/audit-logging 0.8.0
@cap-js/cds-types 0.2.0
@cap-js/hana 1.1.1
@cap-js/openapi 1.0.5
@cap-js/telemetry 0.2.3
@sap/cds 8.1.1
@sap/cds-common-conten 2.1.0
@sap/cds-compiler 5.1.2
@sap/cds-dk 8.1.2
@sap/cds-dk (global) 7.9.4
@sap/cds-fiori 1.2.4
@sap/cds-foss 5.0.1
@sap/cds-indexer 1.0.14
@sap/cds-mtxs 2.0.6
@sap/cds-odata-v2-adap 1.9.21
@sap/cds-shim 0.6.6
@sap/eslint-plugin-cds 3.0.4
Node.js v20.15.0
home /Users/payann/Documents/ace/ace/node_modules/@sap/cds

in the file @cap-js/hana/lib/drivers/hana-client.js at function streamBlob, because the binary buffer is assigned to 65536 ( 1 << 16). if the file is large, then the first 65536 bytes are read and then the next read overwrites the first few bytes which corrupts the file signature.

for now i was able to fix with a patch something like this -async function* streamBlob(rs, rowIndex = -1, columnIndex, binaryBuffer = Buffer.allocUnsafe(1 << 16)) { +async function* streamBlob(rs, rowIndex = -1, columnIndex, binaryBuffer = Buffer.allocUnsafe(1 << 25)) {

nishnp avatar Aug 27 '24 11:08 nishnp