fix tencent_cos_storage image-preview error is not a byte (#6652)

This commit is contained in:
yanghx 2024-07-25 11:20:20 +08:00 committed by GitHub
parent a876baf0a9
commit 349ec0db77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,8 +32,7 @@ class TencentStorage(BaseStorage):
def load_stream(self, filename: str) -> Generator: def load_stream(self, filename: str) -> Generator:
def generate(filename: str = filename) -> Generator: def generate(filename: str = filename) -> Generator:
response = self.client.get_object(Bucket=self.bucket_name, Key=filename) response = self.client.get_object(Bucket=self.bucket_name, Key=filename)
while chunk := response['Body'].get_stream(chunk_size=4096): yield from response['Body'].get_stream(chunk_size=4096)
yield chunk
return generate() return generate()