Skip to content

Commit

Permalink
fix: check for 404 and use proper key variable
Browse files Browse the repository at this point in the history
  • Loading branch information
william-silversmith committed Mar 16, 2024
1 parent ce77685 commit 7d8183c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cloudfiles/cloudfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ def thunk_copy(key):
found = conn.copy_file(src_key, cf_dest._path.bucket, dest_key)

if found == False and not allow_missing:
raise FileNotFoundError(key["path"])
raise FileNotFoundError(src_key)

return int(found)

Expand Down
2 changes: 1 addition & 1 deletion cloudfiles/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ def copy_file(self, src_path, dest_bucket_name, dest_key):
try:
dest_bucket.copy(CopySource=copy_source, Bucket=dest_bucket_name, Key=dest_key)
except botocore.exceptions.ClientError as err:
if err.response['Error']['Code'] == 'NoSuchKey':
if err.response['Error']['Code'] in ('NoSuchKey', '404'):
return False
else:
raise
Expand Down

0 comments on commit 7d8183c

Please sign in to comment.