Skip to content

Commit

Permalink
Fixes a JS error that came in as part of #3760.
Browse files Browse the repository at this point in the history
  • Loading branch information
slackpad committed Dec 21, 2017
1 parent a9436bb commit b81b078
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions ui/javascripts/app/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit b81b078

Please sign in to comment.