weareyou / gatsby-source-umbraco

A source plugin for pulling content and media from Umbraco into Gatsby.
MIT License
12 stars 0 forks source link

Type name can be empty string #5

Closed jessevdp closed 4 years ago

jessevdp commented 4 years ago

The plugin validates every node in the "sitemap" to make sure it has the properties required by the plugin. While the type field of a sitemap node is validated to be a string, the length of the string isn't checked. This means that an empty string ("") would pass validation, that might cause all kinds of weird errors.

https://github.com/weareyou/gatsby-source-umbraco/blob/d64093896eb349c508ab14847b8874943615ed05/lib/fetch-and-validate-sitemap.js#L55-L56

Note that the typePrefix also has effect on the final name of a type. When a type prefix is configured, types with an empty name might be treated as if their type name is just the prefix. E.g. a prefix of Umbraco and an empty type name would result in "Umbraco". This is even more difficult to debug.