Skip to content

Commit dfdeed4

Browse files
authored
fix(gatsby-source-drupal): add image cdn support for files type and typePrefix (#38057)
1 parent e5e2bb7 commit dfdeed4

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

‎packages/gatsby-source-drupal/src/gatsby-node.ts‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
downloadFile,
2222
isFileNode,
2323
imageCDNState,
24+
generateTypeName,
2425
} from "./normalize"
2526

2627
import {
@@ -951,10 +952,22 @@ exports.createSchemaCustomization = (
951952
if (pluginOptions.skipFileDownloads && pluginOptions.imageCDN) {
952953
actions.createTypes([
953954
// polyfill so image CDN works on older versions of Gatsby
955+
// this type is merged in with the inferred file__file and files types, adding Image CDN support via the gatsbyImage GraphQL field. The `RemoteFile` interface as well as the polyfill above are what add the gatsbyImage field.
954956
addRemoteFilePolyfillInterface(
955-
// this type is merged in with the inferred file__file type, adding Image CDN support via the gatsbyImage GraphQL field. The `RemoteFile` interface as well as the polyfill above are what add the gatsbyImage field.
956957
schema.buildObjectType({
957-
name: `file__file`,
958+
name: generateTypeName(`file--file`, pluginOptions.typePrefix),
959+
fields: {},
960+
interfaces: [`Node`, `RemoteFile`],
961+
}),
962+
{
963+
schema,
964+
actions,
965+
store,
966+
}
967+
),
968+
addRemoteFilePolyfillInterface(
969+
schema.buildObjectType({
970+
name: generateTypeName(`files`, pluginOptions.typePrefix),
958971
fields: {},
959972
interfaces: [`Node`, `RemoteFile`],
960973
}),

0 commit comments

Comments
 (0)