diff --git a/src/config.rs b/src/config.rs index ea06918..d0c12bf 100644 --- a/src/config.rs +++ b/src/config.rs @@ -74,7 +74,7 @@ pub struct PasteConfig { pub delete_expired_files: Option, /// Highlight override. #[serde(default)] - pub highlight_override: HashMap, + pub highlight_override: Option>, } /// Cleanup configuration. diff --git a/src/server.rs b/src/server.rs index 8085d8f..fb5d329 100644 --- a/src/server.rs +++ b/src/server.rs @@ -95,8 +95,9 @@ async fn serve( None => "default", }); let mime_str = mime_type.to_string(); - let overrides = &config.paste.highlight_override; - values.insert("type", if overrides.contains_key(&mime_str) { overrides[&mime_str].as_str() } else { "" }); + if let Some(overrides) = &config.paste.highlight_override { + values.insert("type", if overrides.contains_key(&mime_str) { overrides[&mime_str].as_str() } else { "" }); + } let rendered = tmpl.fill_in(&values); return Ok(HttpResponse::Ok().content_type(mime::TEXT_HTML).body(rendered.to_string())) }