Skip to content

Commit

Permalink
fix early bail when testing if string field should link to File node (#…
Browse files Browse the repository at this point in the history
…6504)

* fix early bail when for file inferring

* remove any `application/octet-stream` handling to be in line with mime@2 behaviour

* this can be shorter, doh!
  • Loading branch information
pieh authored and m-allanson committed Jul 18, 2018
1 parent 4159317 commit a8124b0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/gatsby-source-filesystem/src/create-file-node.js
Expand Up @@ -44,7 +44,7 @@ exports.createFileNode = async (
internal = {
contentDigest,
type: `File`,
mediaType: mediaType ? mediaType : `application/octet-stream`,
mediaType,
description: `File "${path.relative(process.cwd(), slashed)}"`,
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-transformer-toml/src/gatsby-node.js
Expand Up @@ -5,7 +5,7 @@ const crypto = require(`crypto`)
async function onCreateNode({ node, actions, loadNodeContent, createNodeId }) {
const { createNode, createParentChildLink } = actions
// Filter out non-toml content
// Currently TOML files are considered 'application/octet-stream' in 'mime-db'
// Currently TOML files are considered null in 'mime-db'
// Hence the extension test instead of mediaType test
if (node.extension !== `toml`) {
return
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby/src/schema/types/type-file.js
Expand Up @@ -28,7 +28,7 @@ export function setFileNodeRootType(fileNodeRootType) {
function pointsToFile(nodes, key, value) {
const looksLikeFile =
_.isString(value) &&
mime.getType(value) !== `application/octet-stream` &&
mime.getType(value) !== null &&
// domains ending with .com
mime.getType(value) !== `application/x-msdownload` &&
isRelative(value) &&
Expand Down

0 comments on commit a8124b0

Please sign in to comment.