Skip to content
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

Merged
merged 1 commit into from
Jun 20, 2018

Conversation

Colhodm
Copy link
Contributor

@Colhodm Colhodm commented Jun 19, 2018

Adds support for Windows OS, if the file that fget_object refers to already exists.
Fixes #665

@harshavardhana
Copy link
Member

The commit title should indicate what this PR does Closes issue #665 is not quite meaningful.

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)):
Copy link
Collaborator

@kannappanr kannappanr Jun 20, 2018

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)

@Colhodm Colhodm changed the title Closes issue #665 Closes issue #665(Fixes File Exists error on Windows OS for fget_object) Jun 20, 2018
@Colhodm Colhodm force-pushed the windows-fgetobject-fix branch from 29457f3 to 01f64f4 Compare June 20, 2018 18:03
@Colhodm Colhodm changed the title Closes issue #665(Fixes File Exists error on Windows OS for fget_object) Closes issue #665(Fixes file exists error on Windows OS for fget_object) Jun 20, 2018
@Colhodm Colhodm force-pushed the windows-fgetobject-fix branch from 01f64f4 to 277cb8b Compare June 20, 2018 19:14
@Colhodm Colhodm changed the title Closes issue #665(Fixes file exists error on Windows OS for fget_object) fget_object: Delete existing file in destination path before copying Fixes #665 Jun 20, 2018
@kannappanr kannappanr changed the title fget_object: Delete existing file in destination path before copying Fixes #665 fget_object: Delete existing file in destination path before copying Jun 20, 2018
minio/api.py Outdated
os.rename(file_part_path, file_path)

# Return the stat

Copy link
Collaborator

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

@Colhodm Colhodm force-pushed the windows-fgetobject-fix branch from 277cb8b to 59fd06a Compare June 20, 2018 22:26
@Colhodm Colhodm force-pushed the windows-fgetobject-fix branch from 59fd06a to 58e8a35 Compare June 20, 2018 22:35
Copy link
Collaborator

@kannappanr kannappanr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@ebozduman ebozduman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kannappanr kannappanr merged commit 9b349c3 into minio:master Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants