Skip to content

Commit b7d124f

Browse files
committed
Remove s3_response & specifically check config for needed vars
1 parent 6a3b0cf commit b7d124f

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,19 +180,18 @@ class S3Adapter {
180180
}
181181
await this.createBucket();
182182
const command = new PutObjectCommand(params);
183-
const response = await this._s3Client.send(command);
183+
await this._s3Client.send(command);
184184
const endpoint = this._endpoint || `https://${this._bucket}.s3.${this._region}.amazonaws.com`;
185185
const location = `${endpoint}/${params.Key}`;
186186

187187
let url;
188-
if (config && typeof config === 'object' && Object.keys(config).length > 0) { // if config is passed, we can generate a presigned url here
188+
if (config?.mount && config?.applicationId) { // if config has required properties for getFileLocation
189189
url = await this.getFileLocation(config, key_without_prefix);
190190
}
191191

192192
return {
193193
location: location, // actual upload location, used for tests
194194
name: key_without_prefix, // filename in storage, consistent with other adapters
195-
s3_response: response, // raw s3 response
196195
...url ? { url: url } : {} // url (optionally presigned) or non-direct access url
197196
};
198197
}

spec/test.spec.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,6 @@ describe('S3Adapter tests', () => {
897897
expect(result).toEqual({
898898
location: jasmine.any(String),
899899
name: 'file.txt',
900-
s3_response: jasmine.any(Object),
901900
url: 'https://presigned-url.com/file.txt'
902901
});
903902
});
@@ -914,7 +913,7 @@ describe('S3Adapter tests', () => {
914913

915914
await expectAsync(
916915
s3.createFile('file.txt', 'hello world', 'text/utf8', {})
917-
).toBeRejectedWithError('Generate key failed');
916+
).toBeRejectedWith('Generate key failed');
918917
});
919918
});
920919

0 commit comments

Comments
 (0)