aboutsummaryrefslogtreecommitdiffstats
path: root/src/listing.rs
diff options
context:
space:
mode:
authorJikstra <34889164+Jikstra@users.noreply.github.com>2021-09-10 13:56:31 +0000
committerGitHub <noreply@github.com>2021-09-10 13:56:31 +0000
commitd0cd4f0f21210cae8677941f6ca4059365767879 (patch)
tree623b58e978ef1c31c11553a5b077f51432a34f84 /src/listing.rs
parentApply requested changes (diff)
parentMerge pull request #598 from svenstaro/dependabot/cargo/sha2-0.9.8 (diff)
downloadminiserve-d0cd4f0f21210cae8677941f6ca4059365767879.tar.gz
miniserve-d0cd4f0f21210cae8677941f6ca4059365767879.zip
Merge branch 'master' into feat_raw_mode
Diffstat (limited to 'src/listing.rs')
-rw-r--r--src/listing.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/listing.rs b/src/listing.rs
index 20768f1..9273025 100644
--- a/src/listing.rs
+++ b/src/listing.rs
@@ -28,7 +28,7 @@ mod percent_encode_sets {
}
/// Query parameters
-#[derive(Deserialize)]
+#[derive(Deserialize, Default)]
pub struct QueryParameters {
pub path: Option<PathBuf>,
pub sort: Option<SortingMethod>,
@@ -389,25 +389,11 @@ pub fn directory_listing(
pub fn extract_query_parameters(req: &HttpRequest) -> QueryParameters {
match Query::<QueryParameters>::from_query(req.query_string()) {
- Ok(query) => QueryParameters {
- sort: query.sort,
- order: query.order,
- download: query.download,
- raw: query.raw,
- qrcode: query.qrcode.to_owned(),
- path: query.path.clone(),
- },
+ Ok(Query(query_params)) => query_params,
Err(e) => {
let err = ContextualError::ParseError("query parameters".to_string(), e.to_string());
errors::log_error_chain(err.to_string());
- QueryParameters {
- sort: None,
- order: None,
- download: None,
- raw: None,
- qrcode: None,
- path: None,
- }
+ QueryParameters::default()
}
}
}