From e9a517b62a2e2c6a56db6bf4d5b979ce22c87c05 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Wed, 19 Feb 2020 12:06:00 +0100 Subject: [PATCH] fix(core): Correctly resolve deprecated asset fields in search query --- .../core/src/api/middleware/asset-interceptor-plugin.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/core/src/api/middleware/asset-interceptor-plugin.ts b/packages/core/src/api/middleware/asset-interceptor-plugin.ts index 72cfdb5409..50f33ab41f 100644 --- a/packages/core/src/api/middleware/asset-interceptor-plugin.ts +++ b/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;