From 2184872efe83fe517e7829ec1d45017d029727bf Mon Sep 17 00:00:00 2001
From: mkovalua
Date: Tue, 4 Nov 2025 15:41:49 +0200
Subject: [PATCH 1/3] fix wrong & < > encoding for preprints general info tab
and browser tab title
---
.../general-information.component.html | 8 ++++----
.../general-information/general-information.component.ts | 2 ++
src/app/shared/services/meta-tags.service.ts | 4 +++-
3 files changed, 9 insertions(+), 5 deletions(-)
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..2496bd293 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.publicData' |
{{ '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) {
@@ -46,7 +46,7 @@ {{ 'preprints.preprintStepper.review.sections.authorAssertions.publicData' |
- {{ 'preprints.preprintStepper.review.sections.authorAssertions.publicPreregistration' | translate }}
+ {{ 'preprints.preprintStepper.review.sections.authorAssertions.publicPreregistration' | translate }} eeee
@switch (preprintValue.hasPreregLinks) {
@@ -56,7 +56,7 @@
}
@case (ApplicabilityStatus.Unavailable) {
- {{ preprintValue.whyNoPrereg }}
+ {{ preprintValue.whyNoPrereg | fixSpecialChar }}
}
@case (ApplicabilityStatus.Applicable) {
@switch (preprintValue.preregLinkInfo) {
@@ -101,7 +101,7 @@ {{ 'preprints.details.supplementalMaterials' | translate }}
{{ 'preprints.preprintStepper.review.sections.authorAssertions.conflictOfInterest' | translate }}
@if (preprintValue.hasCoi) {
- {{ preprintValue.coiStatement }}
+ {{ preprintValue.coiStatement | fixSpecialChar }}
} @else {
{{ '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/services/meta-tags.service.ts b/src/app/shared/services/meta-tags.service.ts
index 28e1c1ec6..d6dedf30f 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 { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe';
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(FixSpecialCharPipe.prototype.transform(title));
}
}
}
From 6b042af3ae3740297d7699f0adbba73c09b50d73 Mon Sep 17 00:00:00 2001
From: mkovalua
Date: Tue, 4 Nov 2025 17:04:45 +0200
Subject: [PATCH 2/3] remove redundant testing chars
---
.../general-information/general-information.component.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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 2496bd293..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
@@ -46,7 +46,7 @@ {{ 'preprints.preprintStepper.review.sections.authorAssertions.publicData' |
- {{ 'preprints.preprintStepper.review.sections.authorAssertions.publicPreregistration' | translate }} eeee
+ {{ 'preprints.preprintStepper.review.sections.authorAssertions.publicPreregistration' | translate }}
@switch (preprintValue.hasPreregLinks) {
From d924616d82211dd2e911ba68d6317fad2ba38459 Mon Sep 17 00:00:00 2001
From: mkovalua
Date: Tue, 4 Nov 2025 17:56:25 +0200
Subject: [PATCH 3/3] use helper function to format bad encoding
---
src/app/shared/helpers/format-bad-encoding.helper.ts | 3 +++
src/app/shared/services/meta-tags.service.ts | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
create mode 100644 src/app/shared/helpers/format-bad-encoding.helper.ts
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 d6dedf30f..8cea2c55d 100644
--- a/src/app/shared/services/meta-tags.service.ts
+++ b/src/app/shared/services/meta-tags.service.ts
@@ -6,7 +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 { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe';
+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';
@@ -276,7 +276,7 @@ export class MetaTagsService {
if (titleTag?.attrs.content) {
const title = `${String(this.defaultMetaTags.siteName)} | ${String(titleTag.attrs.content)}`;
- this.title.setTitle(FixSpecialCharPipe.prototype.transform(title));
+ this.title.setTitle(replaceBadEncodedChars(title));
}
}
}