-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
UI - fix encoding for user-entered paths #6294
Merged
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
405484d
directly depend on route-recognizer
meirish 3f4120e
add path encode helper using route-recognizer normalizer methods
meirish 42f0bcd
encode user-entered paths/ids for places we're not using the built-in…
meirish 0dfd63f
encode secret link params
meirish f50ef8a
decode params from the url, and encode for linked-block and navigate-…
meirish bd063f7
add escape-string-regexp
meirish e852029
use list-controller mixin and escape the string when contructing new …
meirish 87fdc11
update yargs parser
meirish 21d032b
add temp fork of args-parser tokenizer
meirish 8044d0e
use forked tokenizer
meirish b14249b
encode paths in the console service
meirish 21f4f71
add acceptance tests for kv secrets
meirish 9ede572
revert yargs-parser upgrade
meirish 5d08564
make encoding in linked-block an attribute, and use it on secret lists
meirish c4af1b7
egp endpoints are enterprise-only, so include 'enterprise' text in th…
meirish 774eaf2
fix routing test and exclude single quote from encoding tests
meirish 3aaa45b
encode cli string before tokenizing
meirish f5f6605
encode auth_path for use with urlFor
meirish 9e97244
add test for single quote via UI input instead of web cli
meirish 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
add path encode helper using route-recognizer normalizer methods
- Loading branch information
commit 3f4120ec00d34bcbae772b453013b0602d4dcae2
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import RouteRecognizer from 'route-recognizer'; | ||
|
||
const { | ||
Normalizer: { normalizePath, encodePathSegment }, | ||
} = RouteRecognizer; | ||
|
||
export function encodePath(path) { | ||
return path | ||
.split('/') | ||
.map(encodePathSegment) | ||
.join('/'); | ||
} | ||
|
||
export { normalizePath, encodePathSegment }; |
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.
When I did this in Consul Land I wondered whether to use encodeURIComponent or this slightly customized version. Just wondering if I should change to use this
RouteRecognizer
one also?Just been reading this:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent#Description
It mentions something similar to adhere to RFC 3986. I don't follow what impact following this/not following this would mean. Do you know what the ins and outs are? Are
!
etc just reserved for future or something?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.
https://github.com/tildeio/route-recognizer/blob/master/lib/route-recognizer/normalizer.ts#L20 has some good comments - I was thinking it'd be nice to have the same semantics as the router. I think for adapter use it's not strictly necessary, but decoded slashes still look nicer.