We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a2fecde commit 5df8a41Copy full SHA for 5df8a41
src/middleware.ts
@@ -79,8 +79,10 @@ const handleAIClientRedirect = (request: NextRequest) => {
79
// Create new URL with .md extension
80
const newUrl = url.clone();
81
// Handle root path and ensure proper .md extension
82
- const pathname = url.pathname === '/' ? '/index' : url.pathname.replace(/\/$/, '');
83
- newUrl.pathname = pathname + '.md';
+ let pathname = url.pathname === '/' ? '/index' : url.pathname;
+ // Remove trailing slash if present, then add .md
84
+ pathname = pathname.replace(/\/$/, '') + '.md';
85
+ newUrl.pathname = pathname;
86
87
// Clean up the format query parameter if it was used
88
if (forceMarkdown) {
0 commit comments