mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
Added undefined
guards to uses of JSON stringify/parse copying
no issue
- added guards for JSON stringify+parse replacements of `Ember.copy` introduced in 6fe40b941b
This commit is contained in:
parent
6fe40b941b
commit
b7e0614362
@ -318,7 +318,7 @@ export default Controller.extend({
|
||||
// set mobiledoc equal to what's in the editor but create a copy so that
|
||||
// nested objects/arrays don't keep references which can mean that both
|
||||
// scratch and mobiledoc get updated simultaneously
|
||||
this.set('post.mobiledoc', JSON.parse(JSON.stringify(this.post.scratch)));
|
||||
this.set('post.mobiledoc', JSON.parse(JSON.stringify(this.post.scratch || null)));
|
||||
this.set('post.status', status);
|
||||
|
||||
// Set a default title
|
||||
|
@ -312,7 +312,7 @@ export default Component.extend({
|
||||
// `payload.files` is special because it's set by paste/drag-n-drop
|
||||
// events and can't be copied for security reasons
|
||||
let {files} = payload;
|
||||
let payloadCopy = JSON.parse(JSON.stringify(payload));
|
||||
let payloadCopy = JSON.parse(JSON.stringify(payload || null));
|
||||
payloadCopy.files = files;
|
||||
|
||||
// all of the properties that will be passed through to the
|
||||
|
@ -163,7 +163,7 @@ export default Component.extend({
|
||||
}).compact();
|
||||
|
||||
// we need a copy to avoid modifying the object references
|
||||
let sections = JSON.parse(JSON.stringify(matchedItems));
|
||||
let sections = JSON.parse(JSON.stringify(matchedItems || []));
|
||||
|
||||
if (sections.length) {
|
||||
set(sections[0].items[0], 'selected', true);
|
||||
|
Loading…
Reference in New Issue
Block a user