diff options
| author | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-07-03 20:01:07 +0300 |
|---|---|---|
| committer | Arda Serdar Pektezol <1669855+pektezol@users.noreply.github.com> | 2023-07-03 20:01:07 +0300 |
| commit | 5426b3d6dc367b8edb01cbacebf3a884eb3b0004 (patch) | |
| tree | 665b0f1551e0d3f3f0518c88e6a3bb0c1be2a9ab | |
| parent | fix: change demo save location (diff) | |
| download | lphub-5426b3d6dc367b8edb01cbacebf3a884eb3b0004.tar.gz lphub-5426b3d6dc367b8edb01cbacebf3a884eb3b0004.tar.bz2 lphub-5426b3d6dc367b8edb01cbacebf3a884eb3b0004.zip | |
fix: change demo save location
Former-commit-id: 9f12bccafd5433775c7de315950f02f9464777fa
| -rw-r--r-- | backend/controllers/recordController.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/backend/controllers/recordController.go b/backend/controllers/recordController.go index 891dfef..28c55e0 100644 --- a/backend/controllers/recordController.go +++ b/backend/controllers/recordController.go | |||
| @@ -91,12 +91,12 @@ func CreateRecordWithDemo(c *gin.Context) { | |||
| 91 | for i, header := range demoFiles { | 91 | for i, header := range demoFiles { |
| 92 | uuid := uuid.New().String() | 92 | uuid := uuid.New().String() |
| 93 | // Upload & insert into demos | 93 | // Upload & insert into demos |
| 94 | err = c.SaveUploadedFile(header, "parser/"+header.Filename) | 94 | err = c.SaveUploadedFile(header, "backend/parser/demos/"+header.Filename) |
| 95 | if err != nil { | 95 | if err != nil { |
| 96 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 96 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 97 | return | 97 | return |
| 98 | } | 98 | } |
| 99 | f, err := os.Open("parser/" + header.Filename) | 99 | f, err := os.Open("backend/parser/demos/" + header.Filename) |
| 100 | if err != nil { | 100 | if err != nil { |
| 101 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 101 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 102 | return | 102 | return |
| @@ -107,7 +107,7 @@ func CreateRecordWithDemo(c *gin.Context) { | |||
| 107 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 107 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 108 | return | 108 | return |
| 109 | } | 109 | } |
| 110 | hostDemoScoreCount, hostDemoScoreTime, err = parser.ProcessDemo("parser/" + header.Filename) | 110 | hostDemoScoreCount, hostDemoScoreTime, err = parser.ProcessDemo("backend/parser/demos/" + header.Filename) |
| 111 | if err != nil { | 111 | if err != nil { |
| 112 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 112 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 113 | return | 113 | return |
| @@ -125,7 +125,7 @@ func CreateRecordWithDemo(c *gin.Context) { | |||
| 125 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) | 125 | c.JSON(http.StatusBadRequest, models.ErrorResponse(err.Error())) |
| 126 | return | 126 | return |
| 127 | } | 127 | } |
| 128 | os.Remove("parser/" + header.Filename) | 128 | os.Remove("backend/parser/demos/" + header.Filename) |
| 129 | } | 129 | } |
| 130 | // Insert into records | 130 | // Insert into records |
| 131 | if isCoop { | 131 | if isCoop { |