From de08e174c03d1e68ec68826e0a201e4f250442f5 Mon Sep 17 00:00:00 2001 From: Robert Long Date: Wed, 3 Feb 2021 13:38:45 -0800 Subject: [PATCH] Check for empty attribution strings --- src/api/Api.js | 2 +- src/editor/nodes/SceneNode.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/api/Api.js b/src/api/Api.js index 848ff105c..564c7da14 100644 --- a/src/api/Api.js +++ b/src/api/Api.js @@ -891,7 +891,7 @@ export default class Project extends EventEmitter { allow_promotion: publishParams.allowPromotion, name: publishParams.name, attributions: { - creator: publishParams.creatorAttribution, + creator: publishParams.creatorAttribution && publishParams.creatorAttribution.trim(), content: publishParams.contentAttributions } }; diff --git a/src/editor/nodes/SceneNode.js b/src/editor/nodes/SceneNode.js index 93de4cbae..54bbf2b4d 100644 --- a/src/editor/nodes/SceneNode.js +++ b/src/editor/nodes/SceneNode.js @@ -656,7 +656,13 @@ export default class SceneNode extends EditorNodeMixin(Scene) { if (!attribution) return; - const attributionKey = attribution.url || `${attribution.title}_${attribution.author}`; + const url = attribution.url && attribution.url.trim(); + const title = attribution.title && attribution.title.trim(); + const author = attribution.author && attribution.author.trim(); + + if (!url && !title && !author) return; + + const attributionKey = url || `${title}_${author}`; if (seenAttributions.has(attributionKey)) return; seenAttributions.add(attributionKey); contentAttributions.push(attribution);