Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vahidalizad committed Oct 22, 2024
1 parent 82bef30 commit b3c2dad
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class S3Adapter {
accessKeyId: options.accessKey,
secretAccessKey: options.secretKey,
};
} else if (options.credentials) s3Options.credentials = options.credentials;
} else if (options.credentials) {
s3Options.credentials = options.credentials;

Check warning on line 93 in index.js

View check run for this annotation

Codecov / codecov/patch

index.js#L93

Added line #L93 was not covered by tests
}

if (options.accessKey && options.secretKey) {
awsCredentialsDeprecationNotice();
Expand All @@ -104,14 +106,14 @@ class S3Adapter {
}

async createBucket() {
if (this._hasBucket) return;
if (this._hasBucket) { return; }

try {
await this._s3Client.send(new CreateBucketCommand({ Bucket: this._bucket }));
this._hasBucket = true;
} catch (error) {
if (error.name === 'BucketAlreadyOwnedByYou') this._hasBucket = true;
else throw error;
if (error.name === 'BucketAlreadyOwnedByYou') { this._hasBucket = true; }
else { throw error; }
}
}

Expand Down Expand Up @@ -181,7 +183,7 @@ class S3Adapter {
await this.createBucket();
const command = new GetObjectCommand(params);
const response = await this._s3Client.send(command);
if (response && !response.Body) throw new Error(response);
if (response && !response.Body) { throw new Error(response); }

const buffer = await responseToBuffer(response);
return buffer;
Expand Down Expand Up @@ -234,7 +236,7 @@ class S3Adapter {
await this.createBucket();
const command = new GetObjectCommand(params);
const data = await this._s3Client.send(command);
if (data && !data.Body) throw new Error('S3 object body is missing.');
if (data && !data.Body) { throw new Error('S3 object body is missing.'); }

res.writeHead(206, {
'Accept-Ranges': data.AcceptRanges,
Expand Down

0 comments on commit b3c2dad

Please sign in to comment.