mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Removed 'null' parsing in settings model
refs #10582 - I don't think this is a good idea - If a user passses "null", we should treat it as a string - I am not aware of a use case why people have "null" in their database - If people send "null" via the API, we should respect this and accept a string
This commit is contained in:
parent
0c583135ba
commit
0c8373afb7
2 changed files with 1 additions and 6 deletions
|
@ -116,7 +116,6 @@ Settings = ghostBookshelf.Model.extend({
|
|||
|
||||
// transform "0" to false
|
||||
// transform "false" to false
|
||||
// transform "null" to null
|
||||
if (attrs.value === '0' || attrs.value === '1') {
|
||||
attrs.value = !!+attrs.value;
|
||||
}
|
||||
|
@ -125,10 +124,6 @@ Settings = ghostBookshelf.Model.extend({
|
|||
attrs.value = JSON.parse(attrs.value);
|
||||
}
|
||||
|
||||
if (attrs.value === 'null') {
|
||||
attrs.value = null;
|
||||
}
|
||||
|
||||
return attrs;
|
||||
}
|
||||
}, {
|
||||
|
|
|
@ -29,7 +29,7 @@ describe('Unit: models/settings', function () {
|
|||
should.equal(returns.value, true);
|
||||
|
||||
returns = setting.parse({key: 'something', value: 'null'});
|
||||
should.equal(returns.value, null);
|
||||
should.equal(returns.value, 'null');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue