File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -174,6 +174,16 @@ $(document).ready(function () {
174174 return matchingModules ;
175175 }
176176
177+ // Funzione di utility per effettuare l'escape dei caratteri HTML speciali
178+ function escapeHtml ( str ) {
179+ return String ( str )
180+ . replace ( / & / g, '&' )
181+ . replace ( / < / g, '<' )
182+ . replace ( / > / g, '>' )
183+ . replace ( / " / g, '"' )
184+ . replace ( / ' / g, ''' ) ;
185+ }
186+
177187 // Funzione per visualizzare i risultati unificati nella sidebar
178188 function displayUnifiedResults ( searchTerm , recordResults ) {
179189 const container = initSearchResultsContainer ( ) ;
@@ -293,10 +303,11 @@ $(document).ready(function () {
293303
294304 // Se non ci sono risultati né di moduli né di record
295305 if ( matchingModules . length === 0 && recordResults . length === 0 ) {
306+ const safeSearchTerm = escapeHtml ( searchTerm ) ;
296307 container . append ( `
297308 <div class="search-no-results">
298309 <i class="fa fa-search-minus"></i>
299- <p>Nessun risultato trovato per "<strong>${ searchTerm } </strong>"</p>
310+ <p>Nessun risultato trovato per "<strong>${ safeSearchTerm } </strong>"</p>
300311 </div>
301312 ` ) ;
302313 }
You can’t perform that action at this time.
0 commit comments