fix: a model downloaded by URL in Manage Ollama can reach Ollama with the end of the file missing (#31974)

When a model file was downloaded by URL in Manage Ollama, the end of the file could still be on its way to disk when Open WebUI sent it to Ollama, so Ollama got a cut-off copy. The download is now fully on disk before it is sent, so Ollama gets the whole file.

Fixes #31956
This commit is contained in:
Classic298 2026-10-07 14:01:22 +02:00 • committed by GitHub
parent c01d4825af
commit 1e75614505
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1615,6 +1615,7 @@ async def download_file_stream(
progress = round((current_size / progress_total) * 100, 2)
yield f'data: {{"progress": {progress}, "completed": {current_size}, "total": {total_size}}}\n\n'
await f.flush()
done = True
hashed = await asyncio.to_thread(calculate_sha256, file_path, chunk_size)