fix(downloads): a GIF's size warning judges the size it shows
This commit is contained in:
@@ -54,7 +54,10 @@ export type GifVerdict = "too_long" | "may_fail" | "no_preview" | "ok";
|
||||
|
||||
export function gifVerdict(seconds: number, est: { hi: number }): GifVerdict {
|
||||
if (seconds > GIF_MAX_S + 0.0005) return "too_long";
|
||||
if (est.hi > GIF_MAX_BYTES) return "may_fail";
|
||||
if (est.hi > GIF_PREVIEW_MAX_BYTES) return "no_preview";
|
||||
// Judged on the high end as shown (whole megabytes): "about 12–30 MB" beside "it may pass 30 MB"
|
||||
// would contradict itself, and the estimate is no finer than that anyway.
|
||||
const hi = Math.round(est.hi / MB) * MB;
|
||||
if (hi > GIF_MAX_BYTES) return "may_fail";
|
||||
if (hi > GIF_PREVIEW_MAX_BYTES) return "no_preview";
|
||||
return "ok";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user