Skip to content

Commit 12ef60e

Browse files
committed
Fixes multi-character sanitization
Signed-off-by: Daniel Kastl <[email protected]>
1 parent 8ab4d71 commit 12ef60e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/gtt-client/init/controls.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ function setSearchControl(instance: any): void {
4343
if (response.reverse) {
4444
// Add copy to clipboard functionality, if available
4545
if (navigator.clipboard) {
46-
// strip htmls from response title
46+
// Sanitize response title and remove all HTML tags
4747
const sanitizedTitle = DOMPurify.sanitize(response.title, { ALLOWED_TAGS: [] });
48-
const text = sanitizedTitle.replace(/<[^>]*>?/gm, '');
48+
const text = sanitizedTitle.replace(/<\/?[^>]+(>|$)/g, '');
4949
navigator.clipboard.writeText(text);
5050
instance.map.notification.show(instance.i18n.control.copied_location_to_clipboard);
5151
}

0 commit comments

Comments
 (0)