Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix early bail when testing if string field should link to File node #6504

Merged
merged 5 commits into from Jul 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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