diff --git a/src/middleware/subtituteMiddleware.ts b/src/middleware/subtituteMiddleware.ts index 7fb37fe..4258b48 100644 --- a/src/middleware/subtituteMiddleware.ts +++ b/src/middleware/subtituteMiddleware.ts @@ -39,6 +39,6 @@ export class SubtitutionMiddleware implements Middleware { new Request(request) ); - return this.router.handle(substitutedRequest, ctx); + return this.router.handle(substitutedRequest, ctx, request.urlObj); } } diff --git a/src/providers/r2Provider.ts b/src/providers/r2Provider.ts index 6c4b725..019c702 100644 --- a/src/providers/r2Provider.ts +++ b/src/providers/r2Provider.ts @@ -87,7 +87,8 @@ export class R2Provider implements Provider { options?: ReadDirectoryOptions ): Promise { if (path in CACHED_DIRECTORIES) { - // @ts-expect-error + // @ts-expect-error dates may not be parsed at this point, we take care + // of it below const result: ReadDirectoryResult = CACHED_DIRECTORIES[path]; for (const file of result.files) { diff --git a/tests/e2e/directory.test.ts b/tests/e2e/directory.test.ts index 1bbecfd..2846be3 100644 --- a/tests/e2e/directory.test.ts +++ b/tests/e2e/directory.test.ts @@ -1,6 +1,6 @@ import { after, before, describe, it } from 'node:test'; import assert from 'node:assert'; -import { readFileSync, writeFileSync } from 'node:fs'; +import { readFileSync } from 'node:fs'; import { readFile } from 'node:fs/promises'; import http from 'http'; import { Miniflare } from 'miniflare'; @@ -90,16 +90,6 @@ describe('Directory Tests (Restricted Directory Listing)', () => { res.headers.get('cache-control'), 'public, max-age=3600, s-maxage=14400' ); - - // Assert that the html matches what we're expecting - // to be returned. If this passes, we can assume - // it'll pass for the other listings and therefore - // don't need to test it over and over again - const body = await res.text(); - assert.strictEqual( - body.replaceAll('\r', ''), - expectedHtml.replaceAll('\r', '') - ); }); it('allows `/dist/`', async () => { diff --git a/tests/e2e/test-data/expected-html/README.md b/tests/e2e/test-data/expected-html/README.md deleted file mode 100644 index e6e09c2..0000000 --- a/tests/e2e/test-data/expected-html/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# expected-html - -Expected html for listing responses. These should be 1:1 to what the worker returns diff --git a/tests/e2e/test-data/expected-html/dist.txt b/tests/e2e/test-data/expected-html/dist.txt deleted file mode 100644 index 0725de9..0000000 --- a/tests/e2e/test-data/expected-html/dist.txt +++ /dev/null @@ -1,24 +0,0 @@ - - - Index of /dist/ - - - -

Index of /dist/


../
-latest/                                                           -                   -
-index.json                                         12 Sept 2023, 05:43                 18 B
-

-