From a6f2282d70b4585ac61c03dca2a28deb8ae8d24f Mon Sep 17 00:00:00 2001 From: Akilan Date: Sun, 4 Jun 2023 11:26:51 +0100 Subject: [PATCH] added fix profile listing user profile information --- webapi/Profile.go | 8 ++++---- webapi/Search.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/webapi/Profile.go b/webapi/Profile.go index 0477aeb..4d630b2 100644 --- a/webapi/Profile.go +++ b/webapi/Profile.go @@ -31,12 +31,12 @@ type apiBlockRecordProfile struct { /* apiProfileList lists all users profile fields. -Request: GET /profile/list?node[nodeid] +Request: GET /profile/list?node=[nodeid] Response: 200 with JSON structure apiProfileData */ func (api *WebapiInstance) apiProfileList(w http.ResponseWriter, r *http.Request) { - NodeID, valid := DecodeBlake3Hash(r.Form.Get("node")) + NodeID, valid := DecodeBlake3Hash(r.URL.Query().Get("node")) var fields []blockchain.BlockRecordProfile var status int @@ -63,8 +63,8 @@ Response: 200 with JSON structure apiProfileData */ func (api *WebapiInstance) apiProfileRead(w http.ResponseWriter, r *http.Request) { r.ParseForm() - fieldN, err1 := strconv.Atoi(r.Form.Get("field")) - NodeID, valid := DecodeBlake3Hash(r.Form.Get("node")) + fieldN, err1 := strconv.Atoi(r.URL.Query().Get("field")) + NodeID, valid := DecodeBlake3Hash(r.URL.Query().Get("node")) if err1 != nil || fieldN < 0 { http.Error(w, "", http.StatusBadRequest) diff --git a/webapi/Search.go b/webapi/Search.go index 440a8fa..f2871dd 100644 --- a/webapi/Search.go +++ b/webapi/Search.go @@ -358,20 +358,20 @@ Result: 200 with JSON structure SearchResult. Check the field status. */ func (api *WebapiInstance) apiExplore(w http.ResponseWriter, r *http.Request) { r.ParseForm() - offset, _ := strconv.Atoi(r.Form.Get("offset")) - limit, err := strconv.Atoi(r.Form.Get("limit")) + offset, _ := strconv.Atoi(r.URL.Query().Get("offset")) + limit, err := strconv.Atoi(r.URL.Query().Get("limit")) if err != nil { limit = 100 } - fileType, err := strconv.Atoi(r.Form.Get("type")) + fileType, err := strconv.Atoi(r.URL.Query().Get("type")) if err != nil { fileType = -1 } var result *SearchResult - NodeId, valid := DecodeBlake3Hash(r.Form.Get("node")) + NodeId, valid := DecodeBlake3Hash(r.URL.Query().Get("node")) if valid { result = api.ExploreHelper(fileType, limit, offset, NodeId, true) } else {