mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2025-04-22 16:14:09 +00:00
Fix blurhash computation for some animations
In the pure-rust blurhash path, I recently added byte streaming for the image reader, which for some formats (like gif) can produce and operate on the first frame of an animation without downloading the whole file. This means that a blurhash could be calculated and the reader dropped before the writer had written all the bytes to the channel. Erroring in this case is incorrect.
This commit is contained in:
parent
7483ca43f9
commit
742677fff6
1 changed files with 5 additions and 1 deletions
|
@ -97,7 +97,11 @@ where
|
|||
let mut streamer = stream.into_streamer();
|
||||
|
||||
while let Some(res) = streamer.next().await {
|
||||
tx.send(res).await.map_err(|_| UploadError::Canceled)?;
|
||||
if tx.send(res).await.is_err() {
|
||||
// not sending isn't an error, we can sometimes compute blurhashes without the
|
||||
// entire body
|
||||
break;
|
||||
}
|
||||
}
|
||||
drop(tx);
|
||||
|
||||
|
|
Loading…
Reference in a new issue