update missing ui-dir log lines

https://github.com/scottlamb/moonfire-nvr/issues/218#issuecomment-1098671419
This commit is contained in:
Scott Lamb 2022-04-13 20:26:28 -07:00
parent 9e6ac27cb0
commit 21da924d84
2 changed files with 4 additions and 5 deletions

View File

@ -196,7 +196,7 @@ impl Service {
match FsDir::builder().for_path(&d) { match FsDir::builder().for_path(&d) {
Err(e) => { Err(e) => {
warn!( warn!(
"Unable to load --ui-dir={}; will serve no static files: {}", "Unable to load ui dir {}; will serve no static files: {}",
d.display(), d.display(),
e e
); );

View File

@ -11,10 +11,9 @@ use super::{internal_server_err, not_found, ResponseResult, Service};
impl Service { impl Service {
/// Serves a static file if possible. /// Serves a static file if possible.
pub(super) async fn static_file(&self, req: Request<hyper::Body>) -> ResponseResult { pub(super) async fn static_file(&self, req: Request<hyper::Body>) -> ResponseResult {
let dir = self let dir = self.ui_dir.clone().ok_or_else(|| {
.ui_dir not_found("ui dir not configured or missing; no static files available.")
.clone() })?;
.ok_or_else(|| not_found("--ui-dir not configured; no static files available."))?;
let static_req = match StaticFileRequest::parse(req.uri().path()) { let static_req = match StaticFileRequest::parse(req.uri().path()) {
None => return Err(not_found("static file not found")), None => return Err(not_found("static file not found")),
Some(r) => r, Some(r) => r,