Browse Source

fix(core): Correctly resolve deprecated asset fields in search query

Michael Bromley 6 years ago
parent
commit
e9a517b62a
1 changed files with 8 additions and 0 deletions
  1. 8 0
      packages/core/src/api/middleware/asset-interceptor-plugin.ts

+ 8 - 0
packages/core/src/api/middleware/asset-interceptor-plugin.ts

@@ -72,6 +72,14 @@ export class AssetInterceptorPlugin implements ApolloServerPlugin {
                             value.productVariantAsset.preview,
                         );
                     }
+                    // TODO: This path is deprecated and should be removed in a future version
+                    // once the fields are removed from the GraphQL API
+                    if (value.productPreview) {
+                        value.productPreview = toAbsoluteUrl(request, value.productPreview);
+                    }
+                    if (value.productVariantPreview) {
+                        value.productVariantPreview = toAbsoluteUrl(request, value.productVariantPreview);
+                    }
                 }
             }
             return value;