From cfff08f9c6b8cdfa6317e696ecc05e1d7aeedeb8 Mon Sep 17 00:00:00 2001 From: Rajiv Harlalka Date: Tue, 1 Oct 2024 15:40:53 +0530 Subject: [PATCH] fixed sanitized filelinks Signed-off-by: Rajiv Harlalka --- backend/handlers.go | 6 +++--- backend/pkg/models/model.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/handlers.go b/backend/handlers.go index d6c91146..3826709c 100644 --- a/backend/handlers.go +++ b/backend/handlers.go @@ -86,7 +86,7 @@ func HandleApprovePaper(w http.ResponseWriter, r *http.Request) { CourseName: qpDetails.CourseName, Year: qpDetails.Year, Exam: qpDetails.Exam, - FileLink: destFileLink, + FileLink: utils.SanitizeFileLink(destFileLink), ApproveStatus: true, Semester: qpDetails.Semester, FromLibrary: false, @@ -371,8 +371,8 @@ func HandleDeletePaper(w http.ResponseWriter, r *http.Request) { config.Get().Logger.Errorf("HandleDeletePaper: error soft-deleting paper: %+v PaperDetails: %d", err.Error(), requestBody.Id) return } - config.Get().Logger.Infof("HandleDeletePaper: disapproved paper: %d", requestBody.Id) - sendResponse(w, http.StatusOK, httpResp{Message: "File Disapproved successfully"}) + config.Get().Logger.Infof("HandleDeletePaper: Deleted paper: %d", requestBody.Id) + sendResponse(w, http.StatusOK, httpResp{Message: "File Deleted successfully"}) } func populateDB(filename string) error { diff --git a/backend/pkg/models/model.go b/backend/pkg/models/model.go index aea7f309..3df228be 100644 --- a/backend/pkg/models/model.go +++ b/backend/pkg/models/model.go @@ -5,10 +5,10 @@ import ( ) type QuestionPaper struct { - ID int `json:"id,string"` + ID int `json:"id"` CourseCode string `json:"course_code"` CourseName string `json:"course_name"` - Year int `json:"year,string"` + Year int `json:"year"` Exam string `json:"exam"` FileLink string `json:"filelink"` FromLibrary bool `json:"from_library"`