From 4419ead54c71b923f95d44a8abfb7ecef2b1030c Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 22 Mar 2024 10:18:53 -0400 Subject: [PATCH] Delete session on loss --- api/savedata.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/api/savedata.go b/api/savedata.go index 3b5dff7..2671c4b 100644 --- a/api/savedata.go +++ b/api/savedata.go @@ -303,17 +303,15 @@ func (s *Server) HandleSavedataClear(w http.ResponseWriter, r *http.Request) { return } - if sessionCompleted { - fileName := "session" - if slotId != 0 { - fileName += strconv.Itoa(slotId) - } + fileName := "session" + if slotId != 0 { + fileName += strconv.Itoa(slotId) + } - err = os.Remove(fmt.Sprintf("userdata/%s/%s.pzs", hex.EncodeToString(uuid), fileName)) - if err != nil && !os.IsNotExist(err) { - http.Error(w, fmt.Sprintf("failed to delete save file: %s", err), http.StatusInternalServerError) - return - } + err = os.Remove(fmt.Sprintf("userdata/%s/%s.pzs", hex.EncodeToString(uuid), fileName)) + if err != nil && !os.IsNotExist(err) { + http.Error(w, fmt.Sprintf("failed to delete save file: %s", err), http.StatusInternalServerError) + return } w.Write(response)