当我尝试将图像上传到存储桶时,它会引发错误"Invalid bucket name "thum.images ": Bucket name must match the regex "^[a-zA-Z0-9.\-_]{1,255}$""。
我认为存储桶名称没有任何问题。
这是我上传图片的代码:
def upload_thumbnail_image(image_key, thumbnail_image):
thumbnail_image_bucket = os.environ['thumbnail_bucket']
thumbnail_image = #image path
image_key = EFE3-27C8-EEB3-4987/3612d0bc-bdfd-49de-82ee-3e66cbb06807.jpg
try:
new_object = client.upload_file(thumbnail_image, thumbnail_image_bucket, image_key)
return new_object
except Exception as Exc:
set_log(Exc.args[0],True)
Run Code Online (Sandbox Code Playgroud)