From 14ae101610288c93e8738c1981d5294225ec1bb8 Mon Sep 17 00:00:00 2001 From: Kyle Mathews Date: Wed, 17 Jan 2018 19:35:44 -0800 Subject: [PATCH] Allow arrays with more than one file path & ignore empty strings --- packages/gatsby/src/schema/infer-graphql-type.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/gatsby/src/schema/infer-graphql-type.js b/packages/gatsby/src/schema/infer-graphql-type.js index 40e5a5fd05ece..22a400c24031d 100644 --- a/packages/gatsby/src/schema/infer-graphql-type.js +++ b/packages/gatsby/src/schema/infer-graphql-type.js @@ -589,10 +589,12 @@ export function inferObjectStructureFromNodes({ // pointing to a file (from another file). } else if ( nodes[0].internal.type !== `File` && - ((_.isString(value) && shouldInferFile(nodes, nextSelector, value)) || + ((_.isString(value) && + !_.isEmpty(value) && + shouldInferFile(nodes, nextSelector, value)) || (_.isArray(value) && - value.length === 1 && _.isString(value[0]) && + !_.isEmpty(value[0]) && shouldInferFile(nodes, `${nextSelector}[0]`, value[0]))) ) { inferredField = inferFromUri(key, types, _.isArray(value))