diff --git a/Cargo.lock b/Cargo.lock index b80f17a..08fc319 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2084,7 +2084,6 @@ dependencies = [ "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "shrinkwraprs 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tantivy 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "url 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/src/routes/mod.rs b/src/routes/mod.rs index cb9cfc3..03a12fd 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -13,7 +13,6 @@ use rocket::{ use std::{ collections::hash_map::DefaultHasher, hash::Hasher, - io::Read, path::{Path, PathBuf}, }; use template_utils::Ructe; @@ -177,14 +176,11 @@ pub struct CachedFile { pub struct ThemeFile(NamedFile); impl<'r> Responder<'r> for ThemeFile { - fn respond_to(mut self, r: &Request) -> response::Result<'r> { - let mut contents = String::new(); - self.0 - .read_to_string(&mut contents) - .map_err(|_| Status::InternalServerError)?; + fn respond_to(self, r: &Request) -> response::Result<'r> { + let contents = std::fs::read(self.0.path()).map_err(|_| Status::InternalServerError)?; let mut hasher = DefaultHasher::new(); - hasher.write(&contents.as_bytes()); + hasher.write(&contents); let etag = format!("{:x}", hasher.finish()); if r.headers() @@ -206,7 +202,7 @@ impl<'r> Responder<'r> for ThemeFile { #[get("/static/cached/<_build_id>/css/", rank = 1)] pub fn theme_files(file: PathBuf, _build_id: &RawStr) -> Option { - NamedFile::open(Path::new("static/").join(file)) + NamedFile::open(Path::new("static/css/").join(file)) .ok() .map(ThemeFile) }