Skip to content

Commit

Permalink
Remove sanitize() from model/base because clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
joerx committed Apr 3, 2016
1 parent 5f8ef26 commit 4a3d8c7
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 17 deletions.
5 changes: 0 additions & 5 deletions core/server/models/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var _ = require('lodash'),
filters = require('../../filters'),
moment = require('moment'),
Promise = require('bluebird'),
sanitizer = require('validator').sanitize,
schema = require('../../data/schema'),
utils = require('../../utils'),
uuid = require('node-uuid'),
Expand Down Expand Up @@ -183,10 +182,6 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
return proto.finalize.call(this, attrs);
},

sanitize: function sanitize(attr) {
return sanitizer(this.get(attr)).xss();
},

// Get attributes that have been updated (values before a .save() call)
updatedAttributes: function updatedAttributes() {
return this._updatedAttributes || {};
Expand Down
1 change: 0 additions & 1 deletion core/server/models/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ Post = ghostBookshelf.Model.extend({
this.set('html', converter.makeHtml(this.get('markdown')));

// disabling sanitization until we can implement a better version
// this.set('title', this.sanitize('title').trim());
title = this.get('title') || i18n.t('errors.models.post.untitled');
this.set('title', title.trim());

Expand Down
11 changes: 0 additions & 11 deletions core/server/models/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,7 @@ Settings = ghostBookshelf.Model.extend({

return validation.validateActiveTheme(themeName);
});
},

saving: function saving() {
// disabling sanitization until we can implement a better version
// All blog setting keys that need their values to be escaped.
// if (this.get('type') === 'blog' && _.contains(['title', 'description', 'email'], this.get('key'))) {
// this.set('value', this.sanitize('value'));
// }

return ghostBookshelf.Model.prototype.saving.apply(this, arguments);
}

}, {
findOne: function (options) {
// Allow for just passing the key instead of attributes
Expand Down

0 comments on commit 4a3d8c7

Please sign in to comment.