Skip to content

Commit 7a5b66c

Browse files
committed
fix: use env instead of const to show error message
1 parent b19606e commit 7a5b66c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/endpoints/image.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,13 @@ async fn handle_animated_image(
147147
}
148148

149149
let frames = end_frame - start_frame;
150-
150+
151151
if let Some(animate_frame_limit) = &env_config.animate_frame_limit {
152152
if frames >= *animate_frame_limit {
153+
let sec = animate_frame_limit / 24;
153154
return (
154155
StatusCode::PAYLOAD_TOO_LARGE,
155-
"大於 150 秒(3600 幀)的片段無法透過此 API 請求,請向開發者提交片段投稿"
156+
format!("大於 {sec} 秒({animate_frame_limit} 幀)的片段無法透過此 API 請求,請向開發者提交片段投稿")
156157
).into_response();
157158
}
158159
}

0 commit comments

Comments
 (0)