mirror of https://github.com/status-im/consul.git
Fixes a JS error that came in as part of #3760.
This commit is contained in:
parent
a9436bb0ec
commit
b81b078463
|
@ -132,13 +132,20 @@ 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.
|
||||
// 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, "/")
|
||||
clean = value
|
||||
try {
|
||||
clean = decodeURIComponent(clean);
|
||||
} catch (e) {
|
||||
// If they've got something that's not valid URL syntax then keep going;
|
||||
// this means that at worst we might end up double escaping some things.
|
||||
}
|
||||
clean = encodeURIComponent(clean).replace(/%2F/g, "/")
|
||||
this.set('cleanKey', clean);
|
||||
return clean;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue