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

Fixed URL decoding bug. #862

Merged
merged 3 commits into from
Aug 4, 2014
Merged

Fixed URL decoding bug. #862

merged 3 commits into from
Aug 4, 2014

Conversation

kyleknap
Copy link
Contributor

@kyleknap kyleknap commented Aug 4, 2014

Keys were being decoded twice when syncing from s3 to s3.

Keys were being decoded twice when syncing from
s3 to s3.
@kyleknap
Copy link
Contributor Author

kyleknap commented Aug 4, 2014

@jamesls @danielgtaylor

@@ -335,7 +335,8 @@ def __init__(self, session, event_name, handler):
self._handler = handler

def __enter__(self):
self._session.register(self._event_name, self._handler)
self._session.register(self._event_name, self._handler,
Copy link
Member

Choose a reason for hiding this comment

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

The ScopedEventHandler class is a generic class. I don't think it should have the hard coded BucketListerDecodeKeys. It would make more sense if the unique_id could be passed in through the __init__.

@kyleknap
Copy link
Contributor Author

kyleknap commented Aug 4, 2014

I updated the pull request to ensure ScopedEventHandler was kept to be a generic class.

@danielgtaylor
Copy link
Contributor

LGTM 👍


def __enter__(self):
self._session.register(self._event_name, self._handler)
self._session.register(self._event_name, self._handler, self._unique_id)

def __exit__(self, exc_type, exc_value, traceback):
self._session.unregister(self._event_name, self._handler)
Copy link
Member

Choose a reason for hiding this comment

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

Last thing, I believe you need to also pass through the unique_id when you're unregistering it so it can clear that unique id cache that checks if a handler with that name has already been registered.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I was just going off the documentation in session.py. It said that it only needed the handler or the unique_id to unregister. Did not realize the unique_id remains in a cache.

Copy link
Member

Choose a reason for hiding this comment

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

I think we might need to update those docs. Rereading the code again, it definitely looks like you have to provide the unique_id. https://github.com/boto/botocore/blob/develop/botocore/hooks.py#L170

@jamesls
Copy link
Member

jamesls commented Aug 4, 2014

Looks good, just some small feedback.

@kyleknap
Copy link
Contributor Author

kyleknap commented Aug 4, 2014

Just fixed including the unique_id in unregister(). Also added another unit test to test that the ScopedEventHandler can handle unique_id's.

@jamesls
Copy link
Member

jamesls commented Aug 4, 2014

:shipit: Looks good!

kyleknap added a commit that referenced this pull request Aug 4, 2014
@kyleknap kyleknap merged commit 983d6cd into aws:develop Aug 4, 2014
@kyleknap kyleknap deleted the encoding_bug branch August 4, 2014 23:48
thoward-godaddy pushed a commit to thoward-godaddy/aws-cli that referenced this pull request Feb 12, 2022
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