Skip to content

Commit 741daa9

Browse files
committed
parse url
1 parent 7a64fd9 commit 741daa9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

crates/katana/cli/src/args.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ impl NodeArgs {
143143

144144
// Then start the explorer if enabled
145145
if self.explorer.explorer {
146-
let rpc_url = Url::parse(&handle.rpc.addr().to_string())?;
146+
let rpc_url = format!("http://{}", handle.rpc.addr().to_string());
147+
let rpc_url = Url::parse(&rpc_url).context("failed to parse node url")?;
147148
Explorer::new(rpc_url)?.start(self.explorer.addr())?;
148149
}
149150

crates/katana/explorer/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ struct ExplorerAssets;
134134
/// for the explorer to use.
135135
fn inject_rpc_url(html: &str, rpc_url: &Url) -> String {
136136
// Escape special characters to prevent XSS
137-
let url_str = rpc_url.to_string();
138-
let escaped_url = url_str.replace("\"", "\\\"").replace("<", "&lt;").replace(">", "&gt;");
137+
let rpc_url = rpc_url.to_string();
138+
let escaped_url = rpc_url.replace("\"", "\\\"").replace("<", "&lt;").replace(">", "&gt;");
139139

140140
let script = format!(
141141
r#"<script>

0 commit comments

Comments
 (0)