@@ -49,6 +49,23 @@ const ExtensionTab = ({tab}) => {
4949 </ > ) ;
5050}
5151
52+ const valueOrUndefined = ( value ) => {
53+ return typeof value === "undefined" ? undefined : value ;
54+ }
55+ const sanitizeComponent = ( component ) => {
56+ if ( ! component ) return undefined ;
57+ return {
58+ extra : sanitizeComponent ( component . extra ) ,
59+ color : valueOrUndefined ( component . color ) ,
60+ bold : valueOrUndefined ( component . bold ) ,
61+ italic : valueOrUndefined ( component . italic ) ,
62+ underlined : valueOrUndefined ( component . underlined ) ,
63+ strikethrough : valueOrUndefined ( component . strikethrough ) ,
64+ obfuscation : valueOrUndefined ( component . obfuscation ) ,
65+ text : valueOrUndefined ( component . text )
66+ } ;
67+ }
68+
5269export const ExtensionValueTableCell = ( { data} ) => {
5370 if ( ! data ) return '-' ;
5471
@@ -58,7 +75,7 @@ export const ExtensionValueTableCell = ({data}) => {
5875 } else if ( data . type === 'LINK' ) {
5976 return ( < Link to = { data . value ?. link } > < ColoredText text = { data . value ?. text } /> </ Link > ) ;
6077 } else if ( data . type === 'COMPONENT' ) {
61- return ( < MinecraftChat component = { JSON . parse ( data . value ) } /> )
78+ return ( < MinecraftChat component = { sanitizeComponent ( JSON . parse ( data . value ) ) } /> )
6279 } else if ( data . type === 'TIME_MILLISECONDS' ) {
6380 return < FormattedTime timeMs = { value } /> ;
6481 } else if ( data . type === 'DATE_YEAR' ) {
@@ -93,7 +110,7 @@ const ExtensionValue = ({data}) => {
93110 } else if ( data . type === 'COMPONENT' ) {
94111 return ( < p title = { title } >
95112 { icon && < Fa icon = { icon } className = { colorClass } /> } { name }
96- < End > < MinecraftChat component = { JSON . parse ( data . value ) } /> </ End >
113+ < End > < MinecraftChat component = { sanitizeComponent ( JSON . parse ( data . value ) ) } /> </ End >
97114 </ p > )
98115 } else if ( data . type === 'BOOLEAN' ) {
99116 return < p title = { title } >
0 commit comments