From cf47daa8e140cf61e4d965df2840813a9d3fde8c Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Wed, 12 Apr 2017 02:58:45 -0700 Subject: [PATCH] Return 404 on missing static file in todo example. --- examples/todo/src/static_files.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/examples/todo/src/static_files.rs b/examples/todo/src/static_files.rs index 61ed862a..0336de7a 100644 --- a/examples/todo/src/static_files.rs +++ b/examples/todo/src/static_files.rs @@ -1,8 +1,7 @@ -use rocket::response::NamedFile; -use std::io; use std::path::{Path, PathBuf}; +use rocket::response::NamedFile; #[get("/", rank = 5)] -fn all(path: PathBuf) -> io::Result { - NamedFile::open(Path::new("static/").join(path)) +fn all(path: PathBuf) -> Option { + NamedFile::open(Path::new("static/").join(path)).ok() }