[ACS-10116] [ACA] Search page renders HTML from the Description,Title field instead of showing it as plain text

This commit is contained in:
DominikIwanek
2025-09-08 11:30:04 +02:00
parent 7cdab832b0
commit 03d362c11e
2 changed files with 8 additions and 11 deletions

View File

@@ -29,6 +29,7 @@ import { first } from 'rxjs/operators';
import { AppTestingModule } from '../../../testing/app-testing.module';
import { SearchResultsRowComponent } from './search-results-row.component';
import { Component, Input } from '@angular/core';
import { ResultNode } from '@alfresco/js-api/typings';
@Component({
selector: 'aca-datatable-cell-badges',
@@ -241,7 +242,7 @@ describe('SearchResultsRowComponent', () => {
});
});
function createMaliciousEntry(overrides: any): ResultSetRowEntry {
function createMaliciousEntry(overrides: Partial<ResultNode>): ResultSetRowEntry {
return {
entry: {
id: 'test-entry',

View File

@@ -47,14 +47,6 @@ import { DomSanitizer } from '@angular/platform-browser';
host: { class: 'aca-search-results-row' }
})
export class SearchResultsRowComponent implements OnInit {
private settings = inject(AppSettingsService);
private readonly sanitizer = inject(DomSanitizer);
private readonly highlightPrefix = "<span class='aca-highlight'>";
private readonly highlightPostfix = '</span>';
private node: NodeEntry;
@Input({ required: true })
context: any;
@@ -68,7 +60,13 @@ export class SearchResultsRowComponent implements OnInit {
contentStripped = '';
isFile = false;
private settings = inject(AppSettingsService);
private node: NodeEntry;
private readonly destroyRef = inject(DestroyRef);
private readonly sanitizer = inject(DomSanitizer);
private readonly highlightPrefix = "<span class='aca-highlight'>";
private readonly highlightPostfix = '</span>';
constructor(
private store: Store<any>,
@@ -135,8 +133,6 @@ export class SearchResultsRowComponent implements OnInit {
if (title !== name) {
const sanitizedTitle = this.sanitizer.sanitize(SecurityContext.HTML, title);
this.title$.next(sanitizedTitle ? ` ( ${sanitizedTitle} )` : '');
this.title$.next(title ? ` ( ${title} )` : '');
this.titleStripped = this.stripHighlighting(title);
}
}