Skip to content

Commit 5abd18a

Browse files
committed
Update index.js
1 parent 2592fa8 commit 5abd18a

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
@@ -187,13 +187,16 @@ class S3Adapter {
187187
const endpoint = this._endpoint || `https://${this._bucket}.s3.${this._region}.amazonaws.com`;
188188
const location = `${endpoint}/${params.Key}`;
189189

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

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

0 commit comments

Comments
 (0)