Skip to content

Commit

Permalink
fix saving JSON if src dont have value.src key
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorush committed Feb 24, 2024
1 parent c8852ff commit 01065fe
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/json-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,13 @@ function toPropString (propData) {
return Object.entries(propData)
.map(([key, value]) => {
if (key == 'src') {
if (value.id && value.src.includes(assetsUrl)) {
// asset came from 3dstreet
return `${key}: #${value.id}`;
} else if (value.src && !value.src.includes(assetsUrl)) {
// asset came from external sources
// checking to ensure the object's src value is correctly stored
if (value.src && !value.src.includes(assetsUrl)) {
// asset came from external sources. So need to save it src value if it has
return `${key}: ${value.src}`;
} else if (value.id) {
// asset came from 3dstreet. So it has id for link to it
return `${key}: #${value.id}`;
} else {
return `${key}: ${value}`;
}
Expand Down

0 comments on commit 01065fe

Please sign in to comment.