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