mirror of
https://github.com/sigoden/dufs.git
synced 2026-06-07 23:16:54 +03:00
feat: support customizable 404 page (#688)
This commit is contained in:
@@ -295,6 +295,7 @@ pub struct Args {
|
||||
pub render_try_index: bool,
|
||||
pub enable_cors: bool,
|
||||
pub assets: Option<PathBuf>,
|
||||
pub error_page: Option<PathBuf>,
|
||||
#[serde(deserialize_with = "deserialize_log_http")]
|
||||
#[serde(rename = "log-format")]
|
||||
pub http_logger: HttpLogger,
|
||||
@@ -410,6 +411,13 @@ impl Args {
|
||||
args.assets = Some(Args::sanitize_assets_path(assets_path)?);
|
||||
}
|
||||
|
||||
if let Some(assets_path) = &args.assets {
|
||||
let p = assets_path.join("404.html");
|
||||
if p.exists() {
|
||||
args.error_page = Some(p);
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(log_format) = matches.get_one::<String>("log-format") {
|
||||
args.http_logger = log_format.parse()?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user