Escape path for live reload. Fix #1247. (#1266)

zola serve's live reload feature used to fail on Windows due to the path
separator (`\`) to not being escaped.
This commit is contained in:
Aidiakapi 2020-12-23 10:37:05 +01:00 committed by GitHub
parent 657905ed6e
commit 358446a65f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

1
Cargo.lock generated
View file

@ -3270,6 +3270,7 @@ dependencies = [
"notify",
"open",
"relative-path",
"serde_json",
"site",
"termcolor",
"tokio",

View file

@ -36,6 +36,7 @@ ctrlc = "3"
open = "1.2"
globset = "0.4"
relative-path = "1"
serde_json = "1.0"
site = { path = "components/site" }
errors = { path = "components/errors" }

View file

@ -153,13 +153,13 @@ fn rebuild_done_handling(broadcaster: &Sender, res: Result<()>, reload_path: &st
r#"
{{
"command": "reload",
"path": "{}",
"path": {},
"originalPath": "",
"liveCSS": true,
"liveImg": true,
"protocol": ["http://livereload.com/protocols/official-7"]
}}"#,
reload_path
serde_json::to_string(&reload_path).unwrap()
))
.unwrap();
}