diff --git a/package.json b/package.json index d53943f..9e572bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cosmicjs/sdk", - "version": "1.0.12", + "version": "1.0.13", "description": "The official client module for Cosmic. This module helps you easily add dynamic content to your website or application using the Cosmic headless CMS.", "keywords": [ "headlesscms", diff --git a/src/utils/addFullMedia.ts b/src/utils/addFullMedia.ts index 367f72f..6ea8d4e 100644 --- a/src/utils/addFullMedia.ts +++ b/src/utils/addFullMedia.ts @@ -16,8 +16,9 @@ const extractMediaFiles = (obj: any): string[] => { const mediaFiles: string[] = []; JSON.stringify(obj, (_, value) => { if (value && typeof value === 'object') { - if (value.url || value.imgix_url) { - mediaFiles.push(value.url.split('/').pop().split('?')[0]); + const url = value.imgix_url || value.url; + if (url) { + mediaFiles.push(url.split('/').pop().split('?')[0]); } } return value;