diff --git a/internal/api/authentication.go b/internal/api/authentication.go index 176c532a9..0ddd9da6f 100644 --- a/internal/api/authentication.go +++ b/internal/api/authentication.go @@ -85,12 +85,16 @@ func authenticateHandler() func(http.Handler) http.Handler { prefix := getProxyPrefix(r.Header) // otherwise redirect to the login page - u := url.URL{ - Path: prefix + "/login", + returnURL := url.URL{ + Path: prefix + r.URL.Path, + RawQuery: r.URL.RawQuery, + } + q := make(url.Values) + q.Set(returnURLParam, returnURL.String()) + u := url.URL{ + Path: prefix + "/login", + RawQuery: q.Encode(), } - q := u.Query() - q.Set(returnURLParam, prefix+r.URL.Path) - u.RawQuery = q.Encode() http.Redirect(w, r, u.String(), http.StatusFound) return } diff --git a/ui/v2.5/src/docs/en/Changelog/v0190.md b/ui/v2.5/src/docs/en/Changelog/v0190.md index 2bae90887..83b261e1c 100644 --- a/ui/v2.5/src/docs/en/Changelog/v0190.md +++ b/ui/v2.5/src/docs/en/Changelog/v0190.md @@ -11,6 +11,7 @@ * Changed performer aliases to be a list, rather than a string field. ([#3113](https://github.com/stashapp/stash/pull/3113)) ### 🐛 Bug fixes +* Fixed URL not being preserved when redirected to login. ([#3305](https://github.com/stashapp/stash/pull/3305)) * Fixed scene previews not being overwritten when Overwrite option is selected. ([#3256](https://github.com/stashapp/stash/pull/3256)) * Fixed objects without titles not being sorted correctly with objects with titles. ([#3244](https://github.com/stashapp/stash/pull/3244)) * Fixed incorrect new Performer pill being removed when creating Performer from scrape dialog. ([#3251](https://github.com/stashapp/stash/pull/3251))