Skip to content

Commit

Permalink
fix: url issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyspiro committed Sep 11, 2024
1 parent 726b38f commit 1158e45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 3 additions & 2 deletions src/utils/addFullMedia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1158e45

Please sign in to comment.