diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2019-04-26 02:42:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-26 02:42:52 +0000 |
commit | 442ff6b1142ab03f8abc221896d0cb7228678407 (patch) | |
tree | a6de481eaf136eb9d5c739e99c14cae349c5c01a /src/renderer.rs | |
parent | Merge pull request #82 from svenstaro/dependabot/cargo/pretty_assertions-0.6.1 (diff) | |
parent | Merge branch 'master' into no_panics (diff) | |
download | miniserve-442ff6b1142ab03f8abc221896d0cb7228678407.tar.gz miniserve-442ff6b1142ab03f8abc221896d0cb7228678407.zip |
Merge pull request #80 from boastful-squirrel/no_panics
Revamp errors + avoid panics in main()
Diffstat (limited to 'src/renderer.rs')
-rw-r--r-- | src/renderer.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/renderer.rs b/src/renderer.rs index c1dcdb2..b292e70 100644 --- a/src/renderer.rs +++ b/src/renderer.rs @@ -47,7 +47,7 @@ pub fn page( form id="file_submit" action={(upload_route) "?path=" (current_dir)} method="POST" enctype="multipart/form-data" { p { "Select a file to upload or drag it anywhere into the window" } div { - input#file-input type="file" name="file_to_upload" {} + input#file-input type="file" name="file_to_upload" required="" {} button type="submit" { "Upload file" } } } @@ -760,11 +760,10 @@ fn humanize_systemtime(src_time: Option<SystemTime>) -> Option<String> { .map(|duration| HumanTime::from(duration).to_text_en(Accuracy::Rough, Tense::Past)) } -/// Renders error page when file uploading fails -pub fn file_upload_error(error_description: &str, return_address: &str) -> Markup { +/// Renders an error on the webpage +pub fn render_error(error_description: &str, return_address: &str) -> Markup { html! { - h1 { "File uploading failed" } - p { (error_description) } + pre { (error_description) } a href=(return_address) { "Go back to file listing" } |