diff --git a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html index a20d43ff2..96f5793c1 100644 --- a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html +++ b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.html @@ -34,7 +34,7 @@
{{ 'preprints.preprintStepper.review.sections.authorAssertions.noData' | translate }}
} @case (ApplicabilityStatus.Unavailable) { - {{ preprintValue.whyNoData }} + {{ preprintValue.whyNoData | fixSpecialChar }} } @case (ApplicabilityStatus.Applicable) { @for (link of preprintValue.dataLinks; track $index) { @@ -56,7 +56,7 @@{{ 'preprints.preprintStepper.review.sections.authorAssertions.noCoi' | translate }}
} diff --git a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts index cfe1039bd..608628a48 100644 --- a/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts +++ b/src/app/features/preprints/components/preprint-details/general-information/general-information.component.ts @@ -17,6 +17,7 @@ import { ContributorsListComponent } from '@osf/shared/components/contributors-l import { IconComponent } from '@osf/shared/components/icon/icon.component'; import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component'; import { ResourceType } from '@osf/shared/enums/resource-type.enum'; +import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe'; import { ContributorsSelectors, GetBibliographicContributors, @@ -39,6 +40,7 @@ import { PreprintDoiSectionComponent } from '../preprint-doi-section/preprint-do IconComponent, AffiliatedInstitutionsViewComponent, ContributorsListComponent, + FixSpecialCharPipe, ], templateUrl: './general-information.component.html', styleUrl: './general-information.component.scss', diff --git a/src/app/shared/helpers/format-bad-encoding.helper.ts b/src/app/shared/helpers/format-bad-encoding.helper.ts new file mode 100644 index 000000000..8df1c1d44 --- /dev/null +++ b/src/app/shared/helpers/format-bad-encoding.helper.ts @@ -0,0 +1,3 @@ +export function replaceBadEncodedChars(text: string) { + return text.replace(/&/gi, '&').replace(/</gi, '<').replace(/>/gi, '>'); +} diff --git a/src/app/shared/services/meta-tags.service.ts b/src/app/shared/services/meta-tags.service.ts index 28e1c1ec6..8cea2c55d 100644 --- a/src/app/shared/services/meta-tags.service.ts +++ b/src/app/shared/services/meta-tags.service.ts @@ -6,6 +6,7 @@ import { Meta, MetaDefinition, Title } from '@angular/platform-browser'; import { ENVIRONMENT } from '@core/provider/environment.provider'; import { PrerenderReadyService } from '@core/services/prerender-ready.service'; +import { replaceBadEncodedChars } from '@osf/shared/helpers/format-bad-encoding.helper'; import { MetadataRecordFormat } from '../enums/metadata-record-format.enum'; import { HeadTagDef } from '../models/meta-tags/head-tag-def.model'; @@ -274,7 +275,8 @@ export class MetaTagsService { const titleTag = headTags.find((tag) => tag.attrs.name === 'citation_title'); if (titleTag?.attrs.content) { - this.title.setTitle(`${String(this.defaultMetaTags.siteName)} | ${String(titleTag.attrs.content)}`); + const title = `${String(this.defaultMetaTags.siteName)} | ${String(titleTag.attrs.content)}`; + this.title.setTitle(replaceBadEncodedChars(title)); } } }