mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
🐛 Fixed 500 error when wrong field data was passed
closes #10564 - Added similar filtering logic to models/base in `findOne` as in `findPage` to prevent fetching unexistent columns
This commit is contained in:
parent
30c005f848
commit
e109c54245
@ -932,6 +932,11 @@ ghostBookshelf.Model = ghostBookshelf.Model.extend({
|
||||
model.applyDefaultAndCustomFilters(options);
|
||||
}
|
||||
|
||||
// Ensure only valid fields/columns are added to query
|
||||
if (options.columns) {
|
||||
options.columns = _.intersection(options.columns, this.prototype.permittedAttributes());
|
||||
}
|
||||
|
||||
return model.fetch(options);
|
||||
},
|
||||
|
||||
|
@ -384,6 +384,11 @@ User = ghostBookshelf.Model.extend({
|
||||
data = _.cloneDeep(dataToClone),
|
||||
lookupRole = data.role;
|
||||
|
||||
// Ensure only valid fields/columns are added to query
|
||||
if (options.columns) {
|
||||
options.columns = _.intersection(options.columns, this.prototype.permittedAttributes());
|
||||
}
|
||||
|
||||
delete data.role;
|
||||
data = _.defaults(data || {}, {
|
||||
status: 'all'
|
||||
|
Loading…
Reference in New Issue
Block a user