8000 Manually add required padding before base64.b64decode. by lookuptable · Pull Request #595 · GoogleCloudPlatform/python-docs-samples · GitHub
[go: up one dir, main page]

Skip to content

Manually add required padding before base64.b64decode. #595

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

Merged
merged 2 commits into from
Oct 21, 2016

Conversation

lookuptable
Copy link
Contributor

Currently the value of the "X-Endpoint-API-UserInfo" header does not
contain paddings. This causes incorrect padding error when doing
base64.b64decode(). This commit fixes the behavior by manually adding
paddings when necessary.

Currently the value of the "X-Endpoint-API-UserInfo" header does not
contain paddings. This causes incorrect padding error when doing
base64.b64decode(). This commit fixes the behavior by manually adding
paddings when necessary.
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 19, 2016
@@ -42,6 +42,11 @@ def auth_info():
encoded_info = request.headers.get('X-Endpoint-API-UserInfo', None)

if encoded_info:
# Add paddings manually if necessary.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just define a new top-level function called base64_decode and make this function call it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@theacodes
Copy link
Contributor

@dpebot merge when travis is green

@dpebot
Copy link
Collaborator
dpebot commented Oct 20, 2016

Okay! I'll merge when all statuses are green.

@dpebot dpebot added the automerge Merge the pull request once unit tests and other checks pass. label Oct 20, 2016
@dpebot dpebot merged commit c619e66 into GoogleCloudPlatform:master Oct 21, 2016
@lookuptable lookuptable deleted the base64-padding branch October 23, 2016 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge the pull request once unit tests and other checks pass. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0