Don't redirect login to migrate page (#453)

This commit is contained in:
WithoutPants 2020-04-10 08:41:09 +10:00 committed by GitHub
parent 2ab45848a5
commit aef31c8b50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -383,7 +383,8 @@ func DatabaseCheckMiddleware(next http.Handler) http.Handler {
ext := path.Ext(r.URL.Path)
shouldRedirect := ext == "" && r.Method == "GET"
if shouldRedirect && database.NeedsMigration() {
if !strings.HasPrefix(r.URL.Path, "/migrate") {
// #451 - don't redirect if loading login page
if !strings.HasPrefix(r.URL.Path, "/migrate") && !strings.HasPrefix(r.URL.Path, "/login") {
http.Redirect(w, r, "/migrate", 301)
return
}