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 urlsafe_b64endcode #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

dtkav
Copy link
Contributor

@dtkav dtkav commented Jan 24, 2019

I'd like to use the cursors in the query string, but they currently aren't url safe, so some of the characters are url-encoded.

The goal of this diff is to remove the need for url-encoding the cursor.

There are three main changes:

  1. switch to using base64.urlsafe_b64encode and base64.urlsafe_b64decode
  2. strip and re-pad the b64 padding character (=), which would otherwise be url-encoded
  3. fall back to b64decode if urlsafe_b64decode fails (for backwards compatibility)

Let me know what you think!

@moggers87
Copy link
Contributor

Rather than messing around with urlsafe_b64encode, wouldn't it make more sense to do search and replace instead? That would avoid the need to do any fallback and I think the code would be more readable too.

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.

2 participants