File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -101,9 +101,21 @@ const PluginCard = ( { plugin } ) => {
101101 } )
102102 }
103103
104+ // Validate URL before using
105+ const isValidUrl = url => {
106+ try {
107+ const parsed = new URL ( url )
108+ return [ 'http:' , 'https:' ] . includes ( parsed . protocol )
109+ } catch {
110+ return false
111+ }
112+ }
113+
104114 return < div key = { plugin . id } className = "s-card" >
105115 < div className = "s-plugin-title" >
106- < img className = "s-plugin-icon" src = { pluginData . icon } alt = { __ ( 'Plugin icon' , i18n ) } />
116+ { pluginData . icon && isValidUrl ( pluginData . icon ) && (
117+ < img className = "s-plugin-icon" src = { pluginData . icon } alt = { __ ( 'Plugin icon' , i18n ) } />
118+ ) }
107119 < h3 className = "s-card-title" > { plugin . title } </ h3 >
108120 </ div >
109121 < p > { plugin . description } </ p >
You can’t perform that action at this time.
0 commit comments