(path)
| 184 | } |
| 185 | |
| 186 | function shouldRedirectWithTrailingSlash(path) { |
| 187 | if (path === "/" || path.endsWith("/")) { |
| 188 | return false; |
| 189 | } |
| 190 | |
| 191 | const slashCount = (path.match(/\//g) || []).length; |
| 192 | return slashCount <= 1; |
| 193 | } |
| 194 | |
| 195 | function extractPromptFromPath(path) { |
| 196 | const encodedPrompt = path.slice(1, path.endsWith("/") ? -1 : undefined); |