Browse Source

Properly escape `&` in injected live-reload script tag (#825)

"[…] `&` normally indicates the start of a character entity reference or
numeric character reference; writing it as `&` […] allows `&` to be
included in the content of an element or in the value of an attribute."

From: https://en.wikipedia.org/wiki/HTML#Character_and_entity_references
index-subcmd
Jochen Kupperschmidt Vincent Prouillet 4 years ago
parent
commit
587d7396b3
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      components/site/src/lib.rs
  2. +1
    -1
      components/site/tests/site.rs

+ 1
- 1
components/site/src/lib.rs View File

@@ -633,7 +633,7 @@ impl Site {
return html.replace(
"</body>",
&format!(
r#"<script src="/livereload.js?port={}&mindelay=10"></script></body>"#,
r#"<script src="/livereload.js?port={}&amp;mindelay=10"></script></body>"#,
port
),
);


+ 1
- 1
components/site/tests/site.rs View File

@@ -161,7 +161,7 @@ fn can_build_site_without_live_reload() {
assert!(file_exists!(public, "nested_sass/scss.css"));

// no live reload code
assert_eq!(file_contains!(public, "index.html", "/livereload.js?port=1112&mindelay=10"), false);
assert_eq!(file_contains!(public, "index.html", "/livereload.js?port=1112&amp;mindelay=10"), false);

// Both pages and sections are in the sitemap
assert!(file_contains!(


Loading…
Cancel
Save