fix: return 404 for bare /uploads path and correct CHANGELOG

This commit is contained in:
xfy 2026-06-17 14:47:22 +08:00
parent 2d45e0991b
commit 018b3876b7
2 changed files with 24 additions and 4 deletions

View File

@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- 图片响应新增 `Cache-Control``ETag` 头:原始上传文件使用 `immutable, max-age=31536000`,处理变体使用 `max-age=86400`
### Fixed
- 修复 `/uploads/{*path}` 路径因缺少 `ConnectInfo` 扩展而返回 HTTP 500 的问题。
### Changed
- 图片解码、缩放、编码逻辑通过 `tokio::task::spawn_blocking` 移至阻塞线程池,避免阻塞异步运行时。
- 为非图片路由启用 `CompressionLayer``TimeoutLayer``/uploads/*` 图片路由跳过压缩与全局超时。
## [0.2.0] - 2026-06-10
### Added

View File

@ -110,9 +110,14 @@ fn main() {
));
// 静态资源路由:图片文件服务(不加压缩/超时)
let static_routes = axum::Router::new().route(
let static_routes = axum::Router::new()
.route(
"/uploads/{*path}",
axum::routing::get(crate::api::image::serve_image),
)
.route(
"/uploads",
axum::routing::get(|| async { StatusCode::NOT_FOUND }),
);
// 合并upload 路由保持自己独立的 300s 超时app routes 加压缩/30sstatic routes 无任何中间件