[release-12.2.1] Chore: Improve short url redirection (#111183)

Chore: Improve short url redirection (#111162)

Improve short url redirection

(cherry picked from commit 81fe57478f)

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot] 2025-09-16 15:41:37 +02:00 committed by GitHub
parent f6570f8123
commit 50403b38d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 4 deletions

View File

@ -475,10 +475,8 @@ function handleRedirectTo(): void {
let decodedRedirectTo = decodeURIComponent(redirectTo);
if (decodedRedirectTo.startsWith('/goto/')) {
// In this case there should be a request to the backend
if (config.appSubUrl && !decodedRedirectTo.startsWith(config.appSubUrl)) {
decodedRedirectTo = config.appSubUrl + decodedRedirectTo;
}
window.location.replace(decodedRedirectTo);
const urlToRedirectTo = locationUtil.assureBaseUrl(decodedRedirectTo);
window.location.replace(urlToRedirectTo);
return;
}
// Ensure that the appsuburl is stripped from the redirect to in case of a frontend redirect