From 587d7396b35604de4805e7da98c4806b0c5c3bd3 Mon Sep 17 00:00:00 2001 From: Jochen Kupperschmidt Date: Fri, 25 Oct 2019 00:53:18 +0200 Subject: [PATCH] Properly escape `&` in injected live-reload script tag (#825) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "[…] `&` 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 --- components/site/src/lib.rs | 2 +- components/site/tests/site.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index 71e4f77..769b5c9 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -633,7 +633,7 @@ impl Site { return html.replace( "", &format!( - r#""#, + r#""#, port ), ); diff --git a/components/site/tests/site.rs b/components/site/tests/site.rs index e79a0b2..1b9ba2c 100644 --- a/components/site/tests/site.rs +++ b/components/site/tests/site.rs @@ -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&mindelay=10"), false); // Both pages and sections are in the sitemap assert!(file_contains!(