Skip to content

Commit

Permalink
Snapshots: Sanitize orignal url (#23254)
Browse files Browse the repository at this point in the history
(cherry picked from commit fb114a7)
  • Loading branch information
torkelo committed Apr 1, 2020
1 parent 882ed63 commit 9abfbf1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion public/app/features/dashboard/components/DashNav/DashNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { DashboardModel } from '../../state';
import { CoreEvents, StoreState } from 'app/types';
import { ShareModal } from 'app/features/dashboard/components/ShareModal';
import { SaveDashboardModalProxy } from 'app/features/dashboard/components/SaveDashboard/SaveDashboardModalProxy';
import { sanitizeUrl } from 'app/core/utils/text';

export interface OwnProps {
dashboard: DashboardModel;
Expand Down Expand Up @@ -151,6 +152,7 @@ export class DashNav extends PureComponent<Props> {
const { canStar, canSave, canShare, showSettings, isStarred } = dashboard.meta;
const { snapshot } = dashboard;
const snapshotUrl = snapshot && snapshot.originalUrl;

return (
<div className="navbar">
{this.isInFullscreenOrSettings && this.renderBackButton()}
Expand Down Expand Up @@ -239,7 +241,7 @@ export class DashNav extends PureComponent<Props> {
tooltip="Open original dashboard"
classSuffix="snapshot-origin"
icon="gicon gicon-link"
href={snapshotUrl}
href={sanitizeUrl(snapshotUrl)}
/>
)}

Expand Down

0 comments on commit 9abfbf1

Please sign in to comment.