File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
packages/unhead/src/utils Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -37,8 +37,8 @@ export function dedupeKey<T extends HeadTag>(tag: T): string | undefined {
3737 // open graph props can have multiple tags with the same property
3838 if ( props [ n ] !== undefined ) {
3939 const propValue = props [ n ]
40- const isStructured = propValue . includes ( ':' )
41- const isStandardSingle = StandardSingleMetaTags . has ( propValue )
40+ const isStructured = propValue && typeof propValue === 'string' && propValue . includes ( ':' )
41+ const isStandardSingle = propValue && StandardSingleMetaTags . has ( propValue )
4242 const shouldAlwaysDedupe = isStructured || isStandardSingle
4343 const keyPart = ( ! shouldAlwaysDedupe && tag . key ) ? `:key:${ tag . key } ` : ''
4444 return `${ name } :${ propValue } ${ keyPart } `
Original file line number Diff line number Diff line change @@ -9,12 +9,14 @@ function normalizeStyleClassProps(
99 const store = key === 'style' ? new Map ( ) : new Set ( )
1010
1111 function processValue ( rawValue : string ) {
12- const value = rawValue . trim ( )
12+ if ( rawValue == null || rawValue === undefined )
13+ return
14+ const value = String ( rawValue ) . trim ( )
1315 if ( ! value )
1416 return
1517
1618 if ( key === 'style' ) {
17- const [ k , ...v ] = value . split ( ':' ) . map ( s => s . trim ( ) )
19+ const [ k , ...v ] = value . split ( ':' ) . map ( s => s ? s . trim ( ) : '' )
1820 if ( k && v . length )
1921 // @ts -expect-error untyped
2022 store . set ( k , v . join ( ':' ) )
@@ -38,7 +40,7 @@ function normalizeStyleClassProps(
3840 if ( v && v !== 'false' ) {
3941 key === 'style'
4042 // @ts -expect-error untyped
41- ? store . set ( k . trim ( ) , v )
43+ ? store . set ( String ( k ) . trim ( ) , String ( v ) )
4244 : processValue ( k )
4345 }
4446 } )
You can’t perform that action at this time.
0 commit comments