From a9d4fa5351e7b582ea15d59651bec3ed0b302428 Mon Sep 17 00:00:00 2001 From: William Perron Date: Tue, 17 Nov 2020 10:28:45 -0500 Subject: [PATCH] fix dns name for buckets with a period (#16) --- .github/workflows/ci.yml | 7 +++---- src/bucket.ts | 4 +++- src/bucket_test.ts | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e63849..90057ab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,16 +12,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - deno-version: [v1.4.2, nightly] + deno-version: [v1.x, nightly] unstable: [false, true] - # FIXME(lucacasonato): temporarially disable no-check testing (see https://github.com/denoland/deno/issues/7709) - no-check: [false] + no-check: [false, true] env: AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY steps: - name: Setup Deno environment - uses: denolib/setup-deno@v2.2.0 + uses: denolib/setup-deno@v2.3.0 with: deno-version: ${{ matrix.deno-version }} diff --git a/src/bucket.ts b/src/bucket.ts index 2183021..f59d74f 100644 --- a/src/bucket.ts +++ b/src/bucket.ts @@ -48,6 +48,8 @@ export class S3Bucket { this.#bucket = config.bucket; this.#host = config.endpointURL ? new URL(`/${config.bucket}/`, config.endpointURL).toString() + : config.bucket.indexOf(".") >= 0 + ? `https://s3.${config.region}.amazonaws.com/${config.bucket}/` : `https://${config.bucket}.s3.${config.region}.amazonaws.com/`; } @@ -494,7 +496,7 @@ export class S3Bucket { async empty(): Promise { const deleted: string[] = []; for await ( - let k of pooledMap( + const k of pooledMap( 50, this.listAllObjects({ batchSize: 1000 }), async (o) => { diff --git a/src/bucket_test.ts b/src/bucket_test.ts index c8bdd9d..c507728 100644 --- a/src/bucket_test.ts +++ b/src/bucket_test.ts @@ -159,7 +159,7 @@ Deno.test({ ]; try { - for (let k of keys) { + for (const k of keys) { await bucket.putObject(k, content, { contentType: "text/plain" }); } @@ -215,7 +215,7 @@ Deno.test({ ]); } finally { // teardown - for (let k of keys) { + for (const k of keys) { await bucket.deleteObject(k); } } @@ -240,7 +240,7 @@ Deno.test({ "fruits/orange", ]; - for (let k of keys) { + for (const k of keys) { await bucket.putObject(k, content, { contentType: "text/plain" }); }