-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fix query string bugs relating to repeated elements #79
Conversation
jon-betts
commented
Jan 29, 2020
- Also separate out testing of the component
- Remove duplicated testing in other places
- Use the same code more times
- Rather than inventing a new way at the end of get_content_type()
( | ||
"/https://example.com/foo?via.open_sidebar=1", | ||
"http://via.hypothes.is/https://example.com/foo?via.open_sidebar=1", | ||
"text/html", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these tests amount to the same thing, and are replicated lower down. We always pass all params onto the final request. It only changes when we call the original URL to check the resource content type.
"h_open_sidebar": asbool(request.params.get(OPEN_SIDEBAR, False)), | ||
"h_request_config": request.params.get(CONFIG_FROM_FRAME, None), | ||
"h_open_sidebar": asbool(request.params.get(QueryParams.OPEN_SIDEBAR, False)), | ||
"h_request_config": request.params.get(QueryParams.CONFIG_FROM_FRAME, None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit of processing could be moved to QueryParams, but then:
- This code wouldn't have anything to do and would get sad
- The code wouldn't get any shorter as we'd have to unpack whatever we were sent
return exc.HTTPFound(f"{via_url}/{url}", headers=headers) | ||
return exc.HTTPFound( | ||
QueryParams.build_url( | ||
f"{via_url}/{path_url}", request.params, strip_via_params=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f"{via_url}/{path_url}", request.params, strip_via_params=False | |
f"{via_url}/{path_url}", request.params |
It defaults to False
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think I might remove the default to force you to say. This was to make crystal clear the intent.
* Also separate out testing of the component * Remove duplicated testing in other places * Use the same code more times * Rather than inventing a new way at the end of get_content_type()
edd94af
to
487966c
Compare
So after some more research it turns out that the query parameters are case sensitive. I've changed the PR to reflect that and the review points above. |