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 get_args to get next link #303

Merged
merged 1 commit into from
Jun 19, 2020
Merged

Use get_args to get next link #303

merged 1 commit into from
Jun 19, 2020

Conversation

babolivier
Copy link
Contributor

@babolivier babolivier commented Jun 19, 2020

Turns out setting a next link when validating a 3PID is broken since the Python 3 work. Briefly, request.args stores its keys as bytes, so 'nextLink' in request.args works in Python 2 but not in Python 3.

The fix for this is to use get_args, which does the right thing in that regards, and has support for optional arguments since #294.

I assume I missed this when adding Python 3 compatibility because I was assuming get_args was the only way Sydent extracts arguments from a requests - turns out I missed that bit which was doing it another way. There doesn't seem to be other occurrences of that bug (looks like the only occurrence of request.args in the whole codebase is in get_args).

@babolivier babolivier requested a review from a team June 19, 2020 15:41
@babolivier babolivier force-pushed the babolivier/next_link branch from f0058d7 to 0055760 Compare June 19, 2020 15:43
@clokep
Copy link
Member

clokep commented Jun 19, 2020

I assume it is OK to use get_args here even though that pulls out from the JSON in some situations and such?

Copy link
Member

@clokep clokep left a comment

Choose a reason for hiding this comment

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

Seems OK. Thanks for checking there were no other occurrences!

@babolivier
Copy link
Contributor Author

I assume it is OK to use get_args here even though that pulls out from the JSON in some situations and such?

Should be - get_args is a catch-all sort of function that grabs every argument a request might include, either in the URL or in the JSON or both.

@babolivier babolivier merged commit cf4040b into master Jun 19, 2020
@babolivier babolivier deleted the babolivier/next_link branch June 19, 2020 16:45
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