mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
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
|
// Boolean if the value is valid
|
||||||
valueValid: Ember.computed.empty('errors.Value'),
|
valueValid: Ember.computed.empty('errors.Value'),
|
||||||
|
|
||||||
// Escape any user-entered parts that aren't URL-safe, but put slashes back since
|
// 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
|
// they are common in keys, and the UI lets users make "folders" by simply adding
|
||||||
// them to keys.
|
// them to keys.
|
||||||
Key: function(key, value) {
|
Key: function(key, value) {
|
||||||
// setter
|
// setter
|
||||||
if (arguments.length > 1) {
|
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);
|
this.set('cleanKey', clean);
|
||||||
return clean;
|
return clean;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user