From 8c4a16f188e4dc3a82a8e222de9081e595ef3f1b Mon Sep 17 00:00:00 2001 From: Dashon Wells Date: Tue, 1 Aug 2023 23:36:59 -0500 Subject: [PATCH 1/3] Encode single quote in directory path name --- src/renderer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/renderer.rs b/src/renderer.rs index 699a01fc9..2003ae81e 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -267,8 +267,9 @@ fn wget_footer(abs_path: &Uri, root_dir_name: Option<&str>, current_user: Option None => String::new(), }; + let encoded_abs_path = abs_path.to_string().replace("'", "%27"); let command = - format!("wget -rcnHp -R 'index.html*'{cut_dirs}{user_params} '{abs_path}?raw=true'"); + format!("wget -rcnHp -R 'index.html*'{cut_dirs}{user_params} '{encoded_abs_path}?raw=true'"); let click_to_copy = format!("navigator.clipboard.writeText(\"{command}\")"); html! { From 305bae922ff770ab37485d505064094a621a7ec5 Mon Sep 17 00:00:00 2001 From: Dashon Wells Date: Wed, 2 Aug 2023 10:39:05 -0500 Subject: [PATCH 2/3] Run cargo fmt to fix formatting --- src/renderer.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/renderer.rs b/src/renderer.rs index 2003ae81e..5f1677ff0 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -268,8 +268,9 @@ fn wget_footer(abs_path: &Uri, root_dir_name: Option<&str>, current_user: Option }; let encoded_abs_path = abs_path.to_string().replace("'", "%27"); - let command = - format!("wget -rcnHp -R 'index.html*'{cut_dirs}{user_params} '{encoded_abs_path}?raw=true'"); + let command = format!( + "wget -rcnHp -R 'index.html*'{cut_dirs}{user_params} '{encoded_abs_path}?raw=true'" + ); let click_to_copy = format!("navigator.clipboard.writeText(\"{command}\")"); html! { From 77e94499a0a2fd0cc1196df532dea79d529875fe Mon Sep 17 00:00:00 2001 From: Dashon Wells Date: Wed, 2 Aug 2023 11:13:39 -0500 Subject: [PATCH 3/3] use a char instead of string literal --- src/renderer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer.rs b/src/renderer.rs index 5f1677ff0..028925ba6 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -267,7 +267,7 @@ fn wget_footer(abs_path: &Uri, root_dir_name: Option<&str>, current_user: Option None => String::new(), }; - let encoded_abs_path = abs_path.to_string().replace("'", "%27"); + let encoded_abs_path = abs_path.to_string().replace('\'', "%27"); let command = format!( "wget -rcnHp -R 'index.html*'{cut_dirs}{user_params} '{encoded_abs_path}?raw=true'" );