mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
Return "No such object in the index" when /rest/db/file gets called on something that doesn't exist
Better than the confusing result of getting a blank fileinfo that looks valid apart from being all crap.
This commit is contained in:
parent
4fa4668ed6
commit
3c7164846d
@ -615,8 +615,14 @@ func (s *apiService) getDBFile(w http.ResponseWriter, r *http.Request) {
|
|||||||
qs := r.URL.Query()
|
qs := r.URL.Query()
|
||||||
folder := qs.Get("folder")
|
folder := qs.Get("folder")
|
||||||
file := qs.Get("file")
|
file := qs.Get("file")
|
||||||
gf, _ := s.model.CurrentGlobalFile(folder, file)
|
gf, gfOk := s.model.CurrentGlobalFile(folder, file)
|
||||||
lf, _ := s.model.CurrentFolderFile(folder, file)
|
lf, lfOk := s.model.CurrentFolderFile(folder, file)
|
||||||
|
|
||||||
|
if !(gfOk || lfOk) {
|
||||||
|
// This file for sure does not exist.
|
||||||
|
http.Error(w, "No such object in the index", http.StatusNotFound)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
av := s.model.Availability(folder, file)
|
av := s.model.Availability(folder, file)
|
||||||
sendJSON(w, map[string]interface{}{
|
sendJSON(w, map[string]interface{}{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user