Login: convert scheme relative URL to path (#80220)
* Login: convert scheme relative URL to path * linting
This commit is contained in:
@@ -8,7 +8,12 @@ import { useStyles2 } from '@grafana/ui';
|
||||
export function SignInLink() {
|
||||
const location = useLocation();
|
||||
const styles = useStyles2(getStyles);
|
||||
const loginUrl = textUtil.sanitizeUrl(locationUtil.getUrlForPartial(location, { forceLogin: 'true' }));
|
||||
let loginUrl = textUtil.sanitizeUrl(locationUtil.getUrlForPartial(location, { forceLogin: 'true' }));
|
||||
|
||||
// Fix for loginUrl starting with "//" which is a scheme relative URL
|
||||
if (loginUrl.startsWith('//')) {
|
||||
loginUrl = loginUrl.replace(/\/+/g, '/');
|
||||
}
|
||||
|
||||
return (
|
||||
<a className={styles.link} href={loginUrl} target="_self">
|
||||
|
||||
Reference in New Issue
Block a user