fixes (the last)

This commit is contained in:
2025-08-18 22:10:27 +02:00
parent 0f2c0e511f
commit 9a14571c31
4 changed files with 65 additions and 8 deletions

View File

@@ -164,6 +164,12 @@ func (s HTTPServer) upload(w http.ResponseWriter, r *http.Request) {
return
}
if err := s.Service.ReloadCache(id); err != nil {
fmt.Fprintln(os.Stderr, "error: failed to reload data from the disk:", err)
internalServerError(w, r)
return
}
// Respond success
w.WriteHeader(http.StatusCreated)
}
@@ -215,7 +221,13 @@ func (s HTTPServer) histUpload(w http.ResponseWriter, r *http.Request) {
defer file.Close()
if err := s.Service.CopyBackup(gameID, uuid, file); err != nil {
fmt.Fprintln(os.Stderr, "error: failed to write data to disk:", err)
fmt.Fprintln(os.Stderr, "error: failed to write data to the disk:", err)
internalServerError(w, r)
return
}
if err := s.Service.ReloadCache(gameID); err != nil {
fmt.Fprintln(os.Stderr, "error: failed to reload data from the disk:", err)
internalServerError(w, r)
return
}
@@ -271,7 +283,6 @@ func (s HTTPServer) histExists(w http.ResponseWriter, r *http.Request) {
ok(finfo, w, r)
}
func (s HTTPServer) metadata(w http.ResponseWriter, r *http.Request) {
id := chi.URLParam(r, "id")
metadata, err := s.Service.One(id)