Skip to content

Commit e483b8d

Browse files
author
saul-data
committed
Update to allow for Cloudflare S3 download
1 parent 33e5382 commit e483b8d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/dataplane/DataStorage/s3/s3_download.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
FilePath: /General/hello.xlxs
77
"""
88

9-
def s3_download(S3Client, Bucket, S3FilePath, DownloadMethod="Object", LocalFilePath=""):
9+
def s3_download(S3Client, Bucket, S3FilePath, DownloadMethod="Object", LocalFilePath="", ChecksumMode=''):
1010

1111
from datetime import datetime
1212
from io import BytesIO
@@ -29,7 +29,10 @@ def s3_download(S3Client, Bucket, S3FilePath, DownloadMethod="Object", LocalFil
2929
return {"result":"OK", "duration": str(duration), "FilePath": LocalFilePath}
3030

3131
# Download S3 file content to object
32-
objectGet = S3Client.get_object(Bucket=Bucket, Key=S3FilePath, ChecksumMode='ENABLED')["Body"].read()
32+
if ChecksumMode=="ENABLED":
33+
objectGet = S3Client.get_object(Bucket=Bucket, Key=S3FilePath, ChecksumMode='ENABLED')["Body"].read()
34+
else:
35+
objectGet = S3Client.get_object(Bucket=Bucket, Key=S3FilePath)["Body"].read()
3336

3437
duration = datetime.now() - start
3538
return {"result":"OK", "duration": str(duration), "content": objectGet}

0 commit comments

Comments
 (0)