Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix azure stream download (#6063)

Jyongcbbe28f40db0
diff --git a/api/extensions/storage/azure_storage.py b/api/extensions/storage/azure_storage.py
index a712a8bbdb2..3403bc6171a 100644
--- a/api/extensions/storage/azure_storage.py
+++ b/api/extensions/storage/azure_storage.py
@@ -1,5 +1,4 @@
from collections.abc import Generator
-from contextlib import closing
from datetime import datetime, timedelta, timezone
from azure.storage.blob import AccountSasPermissions, BlobServiceClient, ResourceTypes, generate_account_sas
@@ -38,10 +37,9 @@ class AzureStorage(BaseStorage):
def generate(filename: str = filename) -> Generator:
blob = client.get_blob_client(container=self.bucket_name, blob=filename)
- with closing(blob.download_blob()) as blob_stream:
- while chunk := blob_stream.readall():
- yield chunk
-
+ blob_data = blob.download_blob()
+ for chunk in blob_data.chunks():
+ yield from chunk
return generate()
def download(self, filename, target_filepath):