misc-features #62

Merged
matthias merged 20 commits from misc-features into main 2026-01-13 21:31:19 +00:00
Showing only changes of commit 67d7650923 - Show all commits

View File

@@ -219,11 +219,17 @@ async def audiofile_upload(request):
data = array('b', range(4096))
bytes_copied = 0
while True:
bytes_read = await request.stream.readinto(data)
try:
bytes_read = await request.stream.readinto(data)
except OSError as ex:
return f'read error: {ex}', 500
if bytes_read == 0:
# End of body
break
bytes_written = newfile.write(data[:bytes_read])
try:
bytes_written = newfile.write(data[:bytes_read])
except OSError as ex:
return f'write error: {ex}', 500
if bytes_written != bytes_read:
# short writes shouldn't happen
return 'write failure', 500