diff --git a/scripts/apps/authoring/media/MediaCopyMetadataDirective.ts b/scripts/apps/authoring/media/MediaCopyMetadataDirective.ts index 89ca38c292..134a16b7f3 100644 --- a/scripts/apps/authoring/media/MediaCopyMetadataDirective.ts +++ b/scripts/apps/authoring/media/MediaCopyMetadataDirective.ts @@ -16,7 +16,10 @@ function getMediaMetadata(metadata: Partial, fields): Partial 0) { - const values = metadata.subject.filter((subj) => subj.scheme === field.field); + const alreadyAddedSubjectQcodes = new Set((output.subject ?? []).map(({qcode}) => qcode)); + const values = metadata.subject.filter( + (subj) => subj.scheme === field.field && alreadyAddedSubjectQcodes.has(subj.qcode) !== true, + ); if (values.length) { output.subject = output.subject ? output.subject.concat(values) : values;