-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix: Fixes importing url encoded recipe deeplinks #3446
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I think if the configBase64 was not url encoded and it does contain a +, this will cause issues
Uh oh!
There was an error while loading. Please reload this page.
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 we should officially document the format of recipe deeplinks so that external integrations know how to use them. I expect we should use the url_safe version and then url-encode. Unless we are going the route of url_safe_no_pad.
These changes are backwards incompatible which is why I'm hoping we can make an official/decision statement so we have a position to operate from.
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.
They are backwards compatible, but since we have both used url-encoded and not url-encoded versions, it doesn't quite fix it.
is there a point in url-encoding the url_safe version?
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.
Seems like even with base64::engine::general_purpose::URL_SAFE we still want to encode it for maximum interoperability. Eg. %3D unencoded is = which would break if this was part of a query url or form submit.
https://docs.rs/base64/latest/base64/#url-safe-alphabet
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.
I am not sure I follow - the whole point of url safe base64 is that you can use it in, eh, urls. so url safe base64 with the = stripped seems like the most compact and portable way that we can do this
for decoding we'd have to put a bunch of safety measures in place probably, so still try to url-decode it if the base64 decode doesn't work etc
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.
👍 yep we can use URL_SAFE_NO_PAD so the
=are never added into the strings (so no need to url encode). It just means that standard base64 decoding won't work unless you add the NO_PAD option. https://docs.rs/base64/latest/base64/#padding-charactersWe will still have to have backwards compatible decoding for the old ones we generated, so ultimately won't simplify any code but atleast there will be a standard going forward.
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.
I'm working on having the encoding/decoding only done on the server.
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.
great - do you want to do that in this, or merge this first
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.
Implemented: #3489