Commit d0be2d5
fix(assets): flush tokio file after multipart upload to prevent truncated reads
tokio::fs::File::write_all returns as soon as data is copied to an
internal buffer and a blocking write task is spawned — it does NOT wait
for the blocking write to complete. When the File is dropped without
flushing, the last write may still be in-flight. A subsequent fs::read
can then see a truncated file.
This caused flaky E2E failures in the compositor-image-overlay upload
test: the image crate's into_dimensions() would fail with 'unexpected
end of file' because it was parsing a partially-written PNG.
The plugin upload handler in server/mod.rs already had this fix; apply
the same pattern to all asset upload functions (image, audio, font) in
assets.rs and plugin_assets.rs.
Signed-off-by: StreamKit Devin <devin@streamkit.dev>
Co-Authored-By: Claudio Costa <cstcld91@gmail.com>1 parent 63250fd commit d0be2d5
2 files changed
+32
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
280 | 288 | | |
281 | 289 | | |
282 | 290 | | |
| |||
710 | 718 | | |
711 | 719 | | |
712 | 720 | | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
713 | 729 | | |
714 | 730 | | |
715 | 731 | | |
| |||
1253 | 1269 | | |
1254 | 1270 | | |
1255 | 1271 | | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
1256 | 1280 | | |
1257 | 1281 | | |
1258 | 1282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
836 | 836 | | |
837 | 837 | | |
838 | 838 | | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
839 | 847 | | |
840 | 848 | | |
841 | 849 | | |
| |||
0 commit comments