M src/lib.rs => src/lib.rs +4 -2
@@ 2,6 2,7 @@ use std::net::{SocketAddr, IpAddr};
use std::fs::{OpenOptions, self};
use std::io::{Read, Write};
use std::path::PathBuf;
+use std::process::exit;
use warp::hyper::StatusCode;
@@ 112,7 113,8 @@ upload_page_html = """
Ok(config) => config,
Err(e) => {
error!("Error parsing config: {}", e);
- panic!();
+ error!("Aborting...");
+ exit(1);
}
};
@@ 129,7 131,7 @@ upload_page_html = """
Err(e) => {
error!("Error accessing download dir: {}", e);
error!("Aborting...");
- panic!();
+ exit(1);
},
};
M src/main.rs => src/main.rs +2 -2
@@ 54,7 54,8 @@ fn handle_prune() {
if path.is_dir() {
warn!("Somehow found directory in {} during pruning, ignoring", CONFIG.outpath);
continue;
- }
+ }
+
// filesize is in bytes, so we convert
let file_size: f64 = <u64 as Into<i128>>::into(entry.metadata().unwrap().len() / (1024 * 1024)) as f64;
@@ 202,7 203,6 @@ async fn main() {
});
// this is the upload endpoint, if requested by GET, so probably a browser
- // TODO: implement upload in browser
let upload_get = warp::path("upload")
.and(warp::any())
.map(|| warp::reply::html(CONFIG.upload_page_html.clone()));