Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
IResultSeverity,
IResultStatus
} from './html-types';
import {cleanTags} from '../../utils/global';

type InputData = {
data: ContextualizedEvaluation | string;
Expand Down Expand Up @@ -416,6 +417,14 @@ export class FromHDFToHTMLMapper {
.map((control) => (control === 'unmapped' ? 'UM-1' : control))
.filter((control) => control !== 'Rev_4');

// Clean up possible tags that may get passed from the OHDF file
result.hdf.wraps.title = result.hdf.wraps.title
? cleanTags(result.hdf.wraps.title)
: '';
result.hdf.wraps.desc = result.hdf.wraps.desc
? cleanTags(result.hdf.wraps.desc)
: '';

// Assign attributes
return {
..._.set(
Expand Down
6 changes: 6 additions & 0 deletions libs/hdf-converters/src/utils/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,9 @@ export function ensureContextualizedEvaluation(
return contextualizeEvaluation(data);
}
}

// Clean up any unescaped tags
export function cleanTags(text: string) {
return new DOMParser().parseFromString(text, 'text/html').documentElement
.textContent;
}