ShareModal: Remove shareView param when creating a sharing URL (#81976)

This commit is contained in:
Ezequiel Victorero 2024-02-06 12:21:15 -03:00 committed by GitHub
parent cf601fab09
commit eab7990349
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -162,6 +162,17 @@ describe('ShareModal', () => {
`http://localhost:3000/goto/${mockUid}`
);
});
it('should generate render url without shareView param', async () => {
mockLocationHref('http://dashboards.grafana.com/d/abcdefghi/my-dash?shareView=link');
render(<ShareLink {...props} />);
const base = 'http://dashboards.grafana.com/render/d-solo/abcdefghi/my-dash';
const params = '?from=1000&to=2000&orgId=1&panelId=22&width=1000&height=500&tz=UTC';
expect(
await screen.findByRole('link', { name: selectors.pages.SharePanelModal.linkToRenderedImage })
).toHaveAttribute('href', base + params);
});
});
});

View File

@ -52,6 +52,10 @@ export function buildParams({
// Token is unique to the authenticated identity and should not be shared with the URL,
// so we are stripping it from the query params as a safety measure.
searchParams.delete('auth_token');
// The shareView param is used to indicate that the sharing modal is open and should never be included in the URL
searchParams.delete('shareView');
return searchParams;
}