RED-5546: escape html

This commit is contained in:
Dan Percic 2023-02-07 23:30:18 +02:00
parent bd494877da
commit 7aa264653c
7 changed files with 9 additions and 103 deletions

View File

@ -1,7 +1,7 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { workflowFileStatusTranslations } from '@translations/file-status-translations';
import { ISearchListItem } from '@red/domain';
import { stripHtml } from 'string-strip-html';
import { escapeHtml } from '@iqser/common-ui';
@Component({
selector: 'redaction-search-item-template',
@ -14,8 +14,8 @@ export class SearchItemTemplateComponent {
readonly fileStatusTranslations = workflowFileStatusTranslations;
sanitize(value: string) {
return stripHtml(value, {
return escapeHtml(value, {
ignoreTags: ['em'],
}).result;
});
}
}

View File

@ -33,7 +33,6 @@ import { FeaturesService } from '@services/features.service';
import { DossiersCacheService } from '@services/dossiers/dossiers-cache.service';
import { DossierTemplatesService } from '@services/dossier-templates/dossier-templates.service';
import { UserService } from '@users/user.service';
import { stripHtml } from 'string-strip-html';
@Component({
templateUrl: './search-screen.component.html',
@ -302,10 +301,4 @@ export class SearchScreenComponent extends ListingComponent<ISearchListItem> imp
routerLink: file.routerLink,
};
}
stripHtmlForView(value: string) {
return stripHtml(value, {
ignoreTags: ['em'],
}).result;
}
}

View File

@ -83,15 +83,13 @@ export class NotificationsService extends EntitiesService<INotification, Notific
const dossierId = notification.target.dossierId;
const dossier = this._dossiersCacheService.get(dossierId);
const fileName = notification.target.fileName;
const dossierName = notification.target?.dossierName ?? dossier?.dossierName;
return this._translateService.instant(translation, {
fileHref: this._getFileHref(dossier, fileId),
dossierHref: this._getDossierHref(dossier),
dossierName:
notification.target?.dossierName ||
dossier?.dossierName ||
this._translateService.instant(_('notifications.deleted-dossier')),
fileName: fileName || this._translateService.instant(_('file')),
dossierName: dossierName ?? this._translateService.instant(_('notifications.deleted-dossier')),
fileName: fileName ?? this._translateService.instant(_('file')),
user: this._getUsername(notification.userId),
});
}

@ -1 +1 @@
Subproject commit 65da4e2d53010ac0b02b3e0c6e89325838b5dd56
Subproject commit 40517f145e0f8719e49ef133ef271f242d8dd078

View File

@ -2,6 +2,7 @@ export interface INotificationTarget {
fileId: string;
dossierId: string;
fileName: string;
dossierName: string;
[key: string]: unknown;
}

View File

@ -58,7 +58,6 @@
"sass": "^1.58.0",
"scroll-into-view-if-needed": "^3.0.4",
"streamsaver": "^2.0.5",
"string-strip-html": "^13.0.6",
"tslib": "^2.5.0",
"zone.js": "0.12.0"
},

View File

@ -5064,11 +5064,6 @@ co@^4.6.0:
resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184"
integrity sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==
codsen-utils@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/codsen-utils/-/codsen-utils-1.2.0.tgz#d5b9b50c8f1082f3b6bc1e8f6378bb4d714972c6"
integrity sha512-cejy31V+xUI6oxQFTxUmT2cZrmIgUg+bZlWtofn8Xdh2JV43ncJK149QNLfPl4G90nkSrqWn9Xu7ZIcbqMDr4A==
collect-v8-coverage@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.1.tgz#cc2c8e94fc18bbdffe64d6534570c8a673b27f59"
@ -7024,7 +7019,7 @@ html-encoding-sniffer@^3.0.0:
dependencies:
whatwg-encoding "^2.0.0"
html-entities@^2.3.2, html-entities@^2.3.3:
html-entities@^2.3.2:
version "2.3.3"
resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.3.tgz#117d7626bece327fc8baace8868fa6f5ef856e46"
integrity sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==
@ -8504,11 +8499,6 @@ lodash-es@^4.17.21:
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
lodash.clonedeep@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==
lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
@ -8524,21 +8514,11 @@ lodash.merge@^4.6.2:
resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
lodash.trim@^4.5.1:
version "4.5.1"
resolved "https://registry.yarnpkg.com/lodash.trim/-/lodash.trim-4.5.1.tgz#36425e7ee90be4aa5e27bcebb85b7d11ea47aa57"
integrity sha512-nJAlRl/K+eiOehWKDzoBVrSMhK0K3A3YQsUNXHQa5yIrKBAhsZgSu3KoAFoFT+mEgiyBHddZ0pRk1ITpIp90Wg==
lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
integrity sha512-xfBaXQd9ryd9dlSDvnvI0lvxfLJlYAZzXomUYzLKtUeOQvOP5piqAWuGtrhWeqaXK9hhoM/iyJc5AV+XfsX3HQ==
lodash.without@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac"
integrity sha512-M3MefBwfDhgKgINVuBJCO1YR3+gf6s9HNJsIiZ/Ru77Ws6uTb9eBuvrkpzO+9iLoAaRodGuq7tyrPCx+74QYGQ==
lodash@^4.17.14, lodash@^4.17.20, lodash@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
@ -10353,35 +10333,6 @@ range-parser@^1.2.1, range-parser@~1.2.1:
resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.1.tgz#3cf37023d199e1c24d1a55b84800c2f3e6468031"
integrity sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==
ranges-apply@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/ranges-apply/-/ranges-apply-7.0.3.tgz#1d4ff8a599dc8846cf02e4bd2c5fa0bbd5188874"
integrity sha512-xEdAMtSMmuGA75XwO1fV3IOKB0c7WxAt51x3arYTcC30Cf41U8nIbrtyrXyjb9W/GK0/szcug0ja9COnR/LdFA==
dependencies:
ranges-merge "^9.0.3"
tiny-invariant "^1.3.1"
ranges-merge@^9.0.3:
version "9.0.3"
resolved "https://registry.yarnpkg.com/ranges-merge/-/ranges-merge-9.0.3.tgz#da317ffe17641c704553dc5e7dccf19964176255"
integrity sha512-8SakJsq08s2IcrycHZNaCimrnZ7pMqgMixbtziiUTW6szX/lrxLzhrmBkidYfK8CZSFd9tnIvj3/U20GnLASXg==
dependencies:
ranges-push "^7.0.3"
ranges-sort "^6.0.3"
ranges-push@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/ranges-push/-/ranges-push-7.0.3.tgz#f0695c6f34d91b05bc25974e37151e267ee2e591"
integrity sha512-KponCIMAHVkykxFjbkF9H7hnO78Qs4QciPDxDHGwDpqG21TEvz+7jSKTSG/gPpM2zvD6H1Dw0FN747rK2E2wsw==
dependencies:
string-collapse-leading-whitespace "^7.0.3"
string-trim-spaces-only "^5.0.3"
ranges-sort@^6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/ranges-sort/-/ranges-sort-6.0.3.tgz#6320dbdb295f2669aef137389a7b5774f3c70243"
integrity sha512-iEudh7Uvrf+1LWVE3WUqH7rtSGG4f1RqxRzaqmVJpQK1kqqv6tktaJg7A7RtlX7h/LG95fgD+Fd6gM24pYHG5A==
raw-body@2.5.1:
version "2.5.1"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857"
@ -11168,19 +11119,6 @@ string-argv@^0.3.1:
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da"
integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==
string-collapse-leading-whitespace@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/string-collapse-leading-whitespace/-/string-collapse-leading-whitespace-7.0.3.tgz#e3a6744937d8172562aad58ad6c7e6025fa9d977"
integrity sha512-gQz3NEpbEqXgbXIi19rsBm8ivq2TAyhQe6/a0qxGcGYzxlCPrNm+gR60OEeUWLap17IPjVlEfsGl6kWlzfWpFg==
string-left-right@^6.0.6:
version "6.0.6"
resolved "https://registry.yarnpkg.com/string-left-right/-/string-left-right-6.0.6.tgz#c4026ce9a96546ba046b45d59b8f8fbcf600d927"
integrity sha512-MStz865IJtXYeT/KWEU6OlFS7eDbOEZIpSZZPkk05PM5fSBWnpNugOWgx1F9vPB0Stx+kU5noRjeIXG9nwVn/g==
dependencies:
codsen-utils "^1.2.0"
lodash.clonedeep "^4.5.0"
string-length@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/string-length/-/string-length-4.0.2.tgz#a8a8dc7bd5c1a82b9b3c8b87e125f66871b6e57a"
@ -11189,24 +11127,6 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"
string-strip-html@^13.0.6:
version "13.0.6"
resolved "https://registry.yarnpkg.com/string-strip-html/-/string-strip-html-13.0.6.tgz#8b9b22201ffc1f2640a401701ab581728991e64e"
integrity sha512-Y5tUeEjggfcAHRbbFj1fwkqp8AauB1Hm2r/97bOvhovgkFgdzQwOCadSwIGkGPbp4w3S0KFwDPwPWjvkvo0XRA==
dependencies:
codsen-utils "^1.2.0"
html-entities "^2.3.3"
lodash.trim "^4.5.1"
lodash.without "^4.4.0"
ranges-apply "^7.0.3"
ranges-push "^7.0.3"
string-left-right "^6.0.6"
string-trim-spaces-only@^5.0.3:
version "5.0.3"
resolved "https://registry.yarnpkg.com/string-trim-spaces-only/-/string-trim-spaces-only-5.0.3.tgz#8e52681e0919a491c1fd7afc6d1ea64744e5f183"
integrity sha512-86fu6Ny2z38OLXy+4ZHIFDfzggHb+tjs/yXF2Rw65lsbdcG92JzzSxncxbU7kDwpYf4Mm1MftULlnPyrDCs4ow==
"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
@ -11510,11 +11430,6 @@ thunky@^1.0.2:
resolved "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d"
integrity sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==
tiny-invariant@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/tiny-invariant/-/tiny-invariant-1.3.1.tgz#8560808c916ef02ecfd55e66090df23a4b7aa642"
integrity sha512-AD5ih2NlSssTCwsMznbvwMZpJ1cbhkGd2uueNxzv2jDlEeZdU04JQfRnggJQ8DrcVBGjAsCKwFBbDlVNtEMlzw==
tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"