mirror of https://github.com/status-im/consul.git
Merge pull request #3760 from hashicorp/ui-updates
Updates the web UI to escape invalid characters in keys.
This commit is contained in:
commit
a404f3664c
|
@ -6,6 +6,8 @@ IMPROVEMENTS:
|
|||
|
||||
BUG FIXES:
|
||||
|
||||
* ui: Added a URI escape around key/value keys so that it's not possible to create unexpected partial key names when entering characters like `?` inside a key. [GH-3760]
|
||||
|
||||
## 1.0.2 (December 15, 2017)
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -132,6 +132,21 @@ App.Key = Ember.Object.extend(Ember.Validations.Mixin, {
|
|||
// Boolean if the value is valid
|
||||
valueValid: Ember.computed.empty('errors.Value'),
|
||||
|
||||
// Escape any user-entered parts that aren't URL-safe, but put slashes back since
|
||||
// they are common in keys, and the UI lets users make "folders" by simply adding
|
||||
// them to keys.
|
||||
Key: function(key, value) {
|
||||
// setter
|
||||
if (arguments.length > 1) {
|
||||
clean = encodeURIComponent(decodeURIComponent(value)).replace(/%2F/g, "/")
|
||||
this.set('cleanKey', clean);
|
||||
return clean;
|
||||
}
|
||||
|
||||
// getter
|
||||
return this.get('cleanKey')
|
||||
}.property('Key'),
|
||||
|
||||
// The key with the parent removed.
|
||||
// This is only for display purposes, and used for
|
||||
// showing the key name inside of a nested key.
|
||||
|
|
Loading…
Reference in New Issue