Skip to content

Commit

Permalink
Allow only valid values for theme query string
Browse files Browse the repository at this point in the history
Fix GITBOOK-OPEN-1X8D
  • Loading branch information
gregberge committed Jan 14, 2025
1 parent 26e6401 commit fa65c78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/loud-files-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'gitbook': patch
---

Allow only good values for theme query parameter. Avoid having a 500 error when we pass an invalid value.
2 changes: 1 addition & 1 deletion packages/gitbook/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export async function middleware(request: NextRequest) {
}

const theme = url.searchParams.get('theme');
if (theme) {
if (theme === 'dark' || theme === 'light') {
headers.set('x-gitbook-theme', theme);
}

Expand Down

0 comments on commit fa65c78

Please sign in to comment.