Fix JSON.parse console error (#2943)

This commit is contained in:
DingDongSoLong4 2022-09-25 02:06:32 +02:00 committed by GitHub
parent 74191c73ed
commit 4089a5fccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 11 deletions

View File

@ -181,18 +181,16 @@ func Start() error {
})
r.HandleFunc("/customlocales", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
if !c.GetCustomLocalesEnabled() {
return
if c.GetCustomLocalesEnabled() {
// search for custom-locales.json in current directory, then $HOME/.stash
fn := c.GetCustomLocalesPath()
exists, _ := fsutil.FileExists(fn)
if exists {
http.ServeFile(w, r, fn)
return
}
}
// search for custom-locales.json in current directory, then $HOME/.stash
fn := c.GetCustomLocalesPath()
exists, _ := fsutil.FileExists(fn)
if !exists {
return
}
http.ServeFile(w, r, fn)
_, _ = w.Write([]byte("{}"))
})
r.HandleFunc("/login*", func(w http.ResponseWriter, r *http.Request) {