From f5940fcbfc2d84eca2d606a046fd4a7e8875211e Mon Sep 17 00:00:00 2001 From: Emmett Hoolahan Date: Thu, 7 Nov 2024 20:06:36 +0800 Subject: [PATCH] fix(serve): improve URL handling and fix linting issues (#39010) - Replace single quotes with backticks for consistency - Add explicit express.RequestHandler return type - Fix prettier formatting for template literals - Improve code formatting and readability --- packages/gatsby/src/commands/serve.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby/src/commands/serve.ts b/packages/gatsby/src/commands/serve.ts index 70af66e487492..a13f85b87f1e7 100644 --- a/packages/gatsby/src/commands/serve.ts +++ b/packages/gatsby/src/commands/serve.ts @@ -70,7 +70,7 @@ const sanitizeUrl = (url: string): string => { try { // Decode URL and normalize slashes const decoded = decodeURIComponent(url) - return decoded.replace(/\/+/g, '/').replace(/\/$/, '') || '/' + return decoded.replace(/\/+/g, `/`).replace(/\/$/, ``) || `/` } catch (e) { report.warn(`Failed to decode URL: ${url}`) return url