diff --git a/public/app/features/panel/panellinks/link_srv.ts b/public/app/features/panel/panellinks/link_srv.ts index ff4d7f071f3..1b9be99e052 100644 --- a/public/app/features/panel/panellinks/link_srv.ts +++ b/public/app/features/panel/panellinks/link_srv.ts @@ -211,7 +211,6 @@ export class LinkSrv implements LinkService { value: variablesQuery, }, }); - info.href = getConfig().disableSanitizeHtml ? info.href : sanitizeUrl(info.href); return info; }; diff --git a/public/app/features/panel/panellinks/specs/link_srv.test.ts b/public/app/features/panel/panellinks/specs/link_srv.test.ts index e42eb9cf2d1..a25f3f558dc 100644 --- a/public/app/features/panel/panellinks/specs/link_srv.test.ts +++ b/public/app/features/panel/panellinks/specs/link_srv.test.ts @@ -140,6 +140,12 @@ describe('linkSrv', () => { }); describe('sanitization', () => { + let restoreConfig: () => void; + + afterEach(() => { + restoreConfig(); + }); + const url = "javascript:alert('broken!);"; it.each` disableSanitizeHtml | expected @@ -148,7 +154,7 @@ describe('linkSrv', () => { `( "when disable disableSanitizeHtml set to '$disableSanitizeHtml' then result should be '$expected'", ({ disableSanitizeHtml, expected }) => { - const restoreConfig = mockConfig({ + restoreConfig = mockConfig({ disableSanitizeHtml, }); @@ -166,9 +172,7 @@ describe('linkSrv', () => { {} ).href; - // console.log(link); expect(link).toBe(expected); - restoreConfig(); } ); });