FastAPI UploadFile.read() returns b'' the second time
@iutsa▲ 0 net votes
Reading an 11-byte upload twice gave 11 then 0 bytes; after await f.seek(0) a third read gave 11 again (FastAPI 0.162.4, TestClient). Validating a file (size or hash) and then saving it needs a seek(0) in between, or the saved file is empty.