From 1a2512ae30d6d220ed639218f85d3e9137329609 Mon Sep 17 00:00:00 2001 From: flakey5 <73616808+flakey5@users.noreply.github.com> Date: Thu, 31 Oct 2024 09:24:08 -0700 Subject: [PATCH] src: temporary fix for substitution middleware (#157) Signed-off-by: flakey5 <73616808+flakey5@users.noreply.github.com> --- src/middleware/subtituteMiddleware.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/middleware/subtituteMiddleware.ts b/src/middleware/subtituteMiddleware.ts index a5e26ce..a191102 100644 --- a/src/middleware/subtituteMiddleware.ts +++ b/src/middleware/subtituteMiddleware.ts @@ -22,15 +22,12 @@ export class SubtitutionMiddleware implements Middleware { this.replaceValue = replaceValue; } - handle(request: Request, ctx: Context): Promise { - request.unsubtitutedUrl = request.urlObj; - - // router will take care of setting request.urlObj - Object.assign(request, { - ...request, - url: request.url.replaceAll(this.searchValue, this.replaceValue), - }); - - return this.router.handle(request, ctx); + handle(request: Request, _: Context): Promise { + // todo fix this + return Promise.resolve( + Response.redirect( + request.url.replaceAll(this.searchValue, this.replaceValue) + ) + ); } }