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

Use hex instead of hash interface in partMetadata #531

Merged
merged 1 commit into from
Jun 15, 2017

Conversation

vadmeste
Copy link
Member

It would be little easier to use hex directly to express
a part's md5 or sha256 sum instead of hash interface. Convert
hex to base64 whenever we need that.

harshavardhana
harshavardhana previously approved these changes Jun 12, 2017
Copy link
Member

@harshavardhana harshavardhana left a comment

Choose a reason for hiding this comment

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

This a good change tested. LGTM

minio/api.py Outdated
@@ -1558,7 +1559,7 @@ def _do_put_multipart_object(self, bucket_name, object_name, part_metadata,

headers = {
'Content-Length': part_metadata.size,
'Content-Md5': part_metadata.md5hasher.base64digest()
'Content-Md5': base64.b64encode(part_metadata.md5_hex.decode("hex"))
Copy link
Contributor

Choose a reason for hiding this comment

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

For python3 , this does not work - I get an AttributeError: 'str' object has no attribute 'decode' part_metadata.md5_hex is of type string.

Copy link
Member Author

Choose a reason for hiding this comment

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

For python3 , this does not work - I get an AttributeError: 'str' object has no attribute 'decode' part_metadata.md5_hex is of type string.

Weird, I didn't get any error when I tested python3 examples/fput_object.py, can you tell me how did you test exactly ?

Copy link
Contributor

Choose a reason for hiding this comment

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

The error happens if you run python3 fput_object.py, i.e. by moving the fput_object.py from examples/ folder to the main repo directory.

Copy link
Member

Choose a reason for hiding this comment

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

Basically this would import your current code @vadmeste

Copy link
Member Author

Choose a reason for hiding this comment

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

@poornas, the issue is fixed, can you check/review again ?

It would be little easier to use hex directly to express
a part's md5 or sha256 sum instead of hash interface. Convert
hex to base64 whenever we need that.
@vadmeste vadmeste force-pushed the simply_part_metadata branch from 5172886 to 4aebebd Compare June 14, 2017 16:00
@harshavardhana harshavardhana changed the title Part Metadata: Use hex instead of hash interface Use hex instead of hash interface in partMetadata Jun 14, 2017
Copy link
Contributor

@poornas poornas left a comment

Choose a reason for hiding this comment

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

Looks good - tested with python3

@vadmeste
Copy link
Member Author

@harshavardhana can you review this again and merge?

@harshavardhana harshavardhana merged commit d65e85e into minio:master Jun 15, 2017
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.

3 participants