lib/api: Improve ignore loading error handling (fixes #9253) (#9254)

This commit is contained in:
Jakob Borg 2023-12-04 07:11:35 +01:00 committed by GitHub
parent 5bfc540c88
commit 7b1932d64e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,6 @@ import (
"github.com/syncthing/syncthing/lib/discover" "github.com/syncthing/syncthing/lib/discover"
"github.com/syncthing/syncthing/lib/events" "github.com/syncthing/syncthing/lib/events"
"github.com/syncthing/syncthing/lib/fs" "github.com/syncthing/syncthing/lib/fs"
"github.com/syncthing/syncthing/lib/ignore"
"github.com/syncthing/syncthing/lib/locations" "github.com/syncthing/syncthing/lib/locations"
"github.com/syncthing/syncthing/lib/logger" "github.com/syncthing/syncthing/lib/logger"
"github.com/syncthing/syncthing/lib/model" "github.com/syncthing/syncthing/lib/model"
@ -1349,11 +1348,6 @@ func (s *service) getDBIgnores(w http.ResponseWriter, r *http.Request) {
folder := qs.Get("folder") folder := qs.Get("folder")
lines, patterns, err := s.model.LoadIgnores(folder) lines, patterns, err := s.model.LoadIgnores(folder)
if err != nil && !ignore.IsParseError(err) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
sendJSON(w, map[string]interface{}{ sendJSON(w, map[string]interface{}{
"ignore": lines, "ignore": lines,
"expanded": patterns, "expanded": patterns,