-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fget_object: Delete existing file in destination path before copying #668
Conversation
The commit title should indicate what this PR does |
minio/api.py
Outdated
@@ -599,7 +599,12 @@ def fget_object(self, bucket_name, object_name, file_path, request_headers=None) | |||
raise InvalidSizeError(msg) | |||
|
|||
# Rename with destination file. | |||
os.rename(file_part_path, file_path) | |||
if not(os.path.exists(file_path)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be changed to
if os.path.exists(file_path):
os.remove(file_path)
os.rename(file_part_path, file_path)
29457f3
to
01f64f4
Compare
01f64f4
to
277cb8b
Compare
minio/api.py
Outdated
os.rename(file_part_path, file_path) | ||
|
||
# Return the stat | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up unnecessary spaces and fix the indentation of the comment.
# Return the stat
277cb8b
to
59fd06a
Compare
59fd06a
to
58e8a35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds support for Windows OS, if the file that fget_object refers to already exists.
Fixes #665