Skip to content

Commit f3f685b

Browse files
committed
Update index.js
1 parent d8c1e15 commit f3f685b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,16 @@ class S3Adapter {
188188
const endpoint = this._endpoint || `https://${this._bucket}.s3.${this._region}.amazonaws.com`;
189189
const location = `${endpoint}/${params.Key}`;
190190

191-
const url = await this.getFileLocation(config, key_without_prefix);
191+
let url;
192+
if (Object.keys(config).length != 0) { // if config is passed, we can generate a presigned url here
193+
url = await this.getFileLocation(config, key_without_prefix);
194+
}
192195

193196
return {
194197
location: location, // actual upload location, used for tests
195-
url: url, // optionally signed url (can be returned to client)
196198
name: key_without_prefix, // filename in storage, consistent with other adapters
197-
s3_response: response // raw s3 response
199+
s3_response: response, // raw s3 response
200+
...url? {url: url} : {} // url (optionally presigned) or non-direct access url
198201
};
199202
}
200203

0 commit comments

Comments
 (0)