Skip to content

Commit

Permalink
fix(content): force empty arrays when supported entity type is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Rötsch authored and axe312ger committed Dec 18, 2017
1 parent ca5a5fa commit f6d039c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export default function runContentfulImport (params) {
return
}

if (options.skipContentModel && (['contentTypes', 'editorInterfaces'].includes(type))) {
if (options.skipContentModel && (['contentTypes', 'editorInterfaces'].indexOf(type) >= 0)) {
return
}

if (options.contentModelOnly && !(['contentTypes', 'editorInterfaces', 'locales'].includes(type))) {
if (options.contentModelOnly && !(['contentTypes', 'editorInterfaces', 'locales'].indexOf(type) >= 0)) {
return
}

Expand Down
8 changes: 5 additions & 3 deletions lib/parseOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,15 @@ export default function parseOptions (params) {

// Clean up content to only include supported entity types
Object.keys(options.content).forEach((type) => {
if (!SUPPORTED_ENTITY_TYPES.includes(type)) {
if (!SUPPORTED_ENTITY_TYPES.indexOf(type) >= 0) {
delete options.content[type]
} else {
options.content[type] = options.content[type] || []
}
})

SUPPORTED_ENTITY_TYPES.forEach((type) => {
options.content[type] = options.content[type] || []
})

if (typeof options.proxy === 'string') {
options.proxy = proxyStringToObject(options.proxy)
}
Expand Down

0 comments on commit f6d039c

Please sign in to comment.