diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2022-09-20 00:31:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-20 00:31:13 +0000 |
commit | 5a68df14385c730d6087a845250d28adab3c3751 (patch) | |
tree | 62789ab21c8c6a41b2865ae4bf69aed3f87ac644 /src/renderer.rs | |
parent | Add CHANGELOG for plain text READMEs (diff) | |
parent | Merge branch 'svenstaro:master' into restrict-upload-dir (diff) | |
download | miniserve-5a68df14385c730d6087a845250d28adab3c3751.tar.gz miniserve-5a68df14385c730d6087a845250d28adab3c3751.zip |
Merge pull request #858 from jonasdiemer/restrict-upload-dir
Added option restrict-upload-dir
Diffstat (limited to 'src/renderer.rs')
-rw-r--r-- | src/renderer.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index a17b55d..6aad5bd 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -40,6 +40,12 @@ pub fn page( let title_path = breadcrumbs_to_path_string(breadcrumbs); + let upload_allowed = conf.allowed_upload_dir.is_empty() + || conf + .allowed_upload_dir + .iter() + .any(|x| encoded_dir.starts_with(&format!("/{}", x))); + html! { (DOCTYPE) html { @@ -120,7 +126,7 @@ pub fn page( } } div.toolbar_box_group { - @if conf.file_upload { + @if conf.file_upload && upload_allowed { div.toolbar_box { form id="file_submit" action=(upload_action) method="POST" enctype="multipart/form-data" { p { "Select a file to upload or drag it anywhere into the window" } |