File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,11 @@ export default defineEventHandler(async event => {
2020 const query = getQuery ( event )
2121 const theme = query . theme === 'light' ? 'light' : 'dark'
2222 const rawColor = typeof query . color === 'string' ? query . color : null
23- const color =
24- rawColor && ( ACCENT_COLOR_IDS as readonly string [ ] ) . includes ( rawColor )
25- ? `&color=${ rawColor } `
26- : ''
27-
28- return sendRedirect (
29- event ,
30- `/__og-image__/image/share-card/${ packageName } /og.png?theme=${ theme } ${ color } ` ,
31- 302 ,
32- )
23+
24+ const params = new URLSearchParams ( { theme } )
25+ if ( rawColor && ( ACCENT_COLOR_IDS as readonly string [ ] ) . includes ( rawColor ) ) {
26+ params . set ( 'color' , rawColor )
27+ }
28+
29+ return sendRedirect ( event , `/__og-image__/image/share-card/${ packageName } /og.png?${ params } ` , 302 )
3330} )
You can’t perform that action at this time.
0 commit comments