File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
packages/theme/src/cli/utilities/theme-environment/hot-reload Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ interface Error {
55
66const POLARIS_STYLESHEET_URL = 'https://unpkg.com/@shopify/[email protected] /build/esm/styles.css' 77
8+ function escapeHtml ( unsafe : string ) {
9+ return unsafe
10+ . replace ( / & / g, '&' )
11+ . replace ( / < / g, '<' )
12+ . replace ( / > / g, '>' )
13+ . replace ( / " / g, '"' )
14+ . replace ( / ' / g, ''' )
15+ }
16+
817export function getErrorPage ( options : { title : string ; header : string ; errors : Error [ ] } ) {
918 const html = String . raw
1019 return html `<!DOCTYPE html>
@@ -64,9 +73,9 @@ export function getErrorPage(options: {title: string; header: string; errors: Er
6473 . map (
6574 ( error ) => `
6675 <div>
67- <span class="Polaris-Text--root Polaris-Text--headingSm">${ error . message } </span>
76+ <span class="Polaris-Text--root Polaris-Text--headingSm">${ escapeHtml ( error . message ) } </span>
6877 <ul class="Polaris-List">
69- <li class="Polaris-List__Item">${ error . code } </li>
78+ <li class="Polaris-List__Item">${ escapeHtml ( error . code ) } </li>
7079 </ul>
7180 </div>` ,
7281 )
You can’t perform that action at this time.
0 commit comments