diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2023-08-03 05:29:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-03 05:29:53 +0000 |
commit | 5d252d30876d22504a068f36ee127308cdc65696 (patch) | |
tree | 834bcd20805d01d4a1f65d8737f32f18ad354e90 | |
parent | Merge pull request #1189 from svenstaro/dependabot/cargo/serde-1.0.180 (diff) | |
parent | use a char instead of string literal (diff) | |
download | miniserve-5d252d30876d22504a068f36ee127308cdc65696.tar.gz miniserve-5d252d30876d22504a068f36ee127308cdc65696.zip |
Merge pull request #1191 from d-air1/encode-quotes-in-directory-path
Encode single quote in directory path name
-rw-r--r-- | src/renderer.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index 699a01f..028925b 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -267,8 +267,10 @@ fn wget_footer(abs_path: &Uri, root_dir_name: Option<&str>, current_user: Option None => String::new(), }; - let command = - format!("wget -rcnHp -R 'index.html*'{cut_dirs}{user_params} '{abs_path}?raw=true'"); + 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 click_to_copy = format!("navigator.clipboard.writeText(\"{command}\")"); html! { |