From 349ec0db7749fd6154cd4212cd3560287300a980 Mon Sep 17 00:00:00 2001 From: yanghx <30469680+yanghx-git@users.noreply.github.com> Date: Thu, 25 Jul 2024 11:20:20 +0800 Subject: [PATCH] fix tencent_cos_storage image-preview error is not a byte (#6652) --- api/extensions/storage/tencent_storage.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/extensions/storage/tencent_storage.py b/api/extensions/storage/tencent_storage.py index 6d9fb80f5e..e2c1ca55e3 100644 --- a/api/extensions/storage/tencent_storage.py +++ b/api/extensions/storage/tencent_storage.py @@ -32,8 +32,7 @@ class TencentStorage(BaseStorage): def load_stream(self, filename: str) -> Generator: def generate(filename: str = filename) -> Generator: response = self.client.get_object(Bucket=self.bucket_name, Key=filename) - while chunk := response['Body'].get_stream(chunk_size=4096): - yield chunk + yield from response['Body'].get_stream(chunk_size=4096) return generate()