feat: 添加图片 Content-Type 支持 (png/jpg/gif/svg/webp)
This commit is contained in:
@@ -12,6 +12,11 @@ pub async fn serve_static_files(path: web::Path<String>) -> impl Responder {
|
||||
Some(file) => {
|
||||
let content_type = match file_path.split('.').next_back() {
|
||||
Some("ico") => "image/x-icon",
|
||||
Some("png") => "image/png",
|
||||
Some("jpg") | Some("jpeg") => "image/jpeg",
|
||||
Some("gif") => "image/gif",
|
||||
Some("svg") => "image/svg+xml",
|
||||
Some("webp") => "image/webp",
|
||||
Some("css") => "text/css",
|
||||
Some("js") => "application/javascript",
|
||||
Some("html") => "text/html",
|
||||
|
||||
Reference in New Issue
Block a user