fix: Update image upload method with explicit file name parameter
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
85640b8284
commit
33897552e7
@ -133,7 +133,7 @@ class ImageGenerator:
|
||||
await browser.close()
|
||||
|
||||
# 上传图片
|
||||
image_url = utils.upload_image(image_path)
|
||||
image_url = utils.upload_image(image_path, image_path)
|
||||
|
||||
# 删除本地文件
|
||||
try:
|
||||
@ -216,7 +216,7 @@ class ImageGenerator:
|
||||
await browser.close()
|
||||
|
||||
# 上传图片
|
||||
image_url = utils.upload_image(image_path)
|
||||
image_url = utils.upload_image(image_path, image_path)
|
||||
|
||||
# 删除本地文件
|
||||
try:
|
||||
|
||||
2
utils.py
2
utils.py
@ -271,7 +271,7 @@ def upload_image(image_path, file_name=None):
|
||||
|
||||
# 生成唯一的文件名
|
||||
if not file_name:
|
||||
timestamp = datetime.now().strftime('%Y%m%d%H%M%S')
|
||||
timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S')
|
||||
random_id = str(uuid.uuid4())[:8]
|
||||
file_extension = os.path.splitext(image_path)[1]
|
||||
object_key = f'dotabot/{timestamp}_{random_id}{file_extension}'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user