Closed ochrstn closed 1 year ago
Hi!
Firstly, thanks for your work on this project! 🙂
I encountered a problem today while reading a file from a S3 compatible storage (https://www.digitalocean.com/products/spaces/) using getFileAsReadable
getFileAsReadable
The resulting stream was always empty or corrupt (if not specifying end parameter) because the generated Range parameter looked like this:
Range
range=0-undefined
Here is the diff that solved my problem by locally patching the transpiled code:
diff --git a/node_modules/@tweedegolf/storage-abstraction/dist/AdapterAmazonS3.js b/node_modules/@tweedegolf/storage-abstraction/dist/AdapterAmazonS3.js index 9a8f6b4..be4e1ff 100644 --- a/node_modules/@tweedegolf/storage-abstraction/dist/AdapterAmazonS3.js +++ b/node_modules/@tweedegolf/storage-abstraction/dist/AdapterAmazonS3.js @@ -137,7 +137,7 @@ var AdapterAmazonS3 = /** @class */ (function (_super) { params = { Bucket: this.bucketName, Key: fileName, - Range: "bytes=" + options.start + "-" + options.end, + Range: `bytes=${options.start}-${options.end || ""}` }; // console.log(`bytes=${options.start}-${options.end}`); return [4 /*yield*/, this.storage.headObject(params).promise()];
I can provide a merge request if you want.
I didn't test if that problem also occurs on AWS S3.
Thanks! I have added your solution to version 1.4.5
Hi!
Firstly, thanks for your work on this project! 🙂
I encountered a problem today while reading a file from a S3 compatible storage (https://www.digitalocean.com/products/spaces/) using
getFileAsReadable
The resulting stream was always empty or corrupt (if not specifying end parameter) because the generated
Range
parameter looked like this:range=0-undefined
Here is the diff that solved my problem by locally patching the transpiled code:
I can provide a merge request if you want.
I didn't test if that problem also occurs on AWS S3.