diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-05-29 21:07:31 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-05-29 21:13:14 +0200 |
commit | 1ed866d31ddeec5ab484760bada2355bbf49c698 (patch) | |
tree | a278178ed8bc71f7349d1afce16cca2c798b7181 /src/rest-api/handler/handler.go | |
parent | rest-api: handle payloads with an api_key (diff) | |
download | fs-tracer-backend-1ed866d31ddeec5ab484760bada2355bbf49c698.tar.gz fs-tracer-backend-1ed866d31ddeec5ab484760bada2355bbf49c698.tar.bz2 fs-tracer-backend-1ed866d31ddeec5ab484760bada2355bbf49c698.zip |
rest-api: Take file path in query params
Diffstat (limited to 'src/rest-api/handler/handler.go')
-rw-r--r-- | src/rest-api/handler/handler.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/rest-api/handler/handler.go b/src/rest-api/handler/handler.go index 4b9a426..354378f 100644 --- a/src/rest-api/handler/handler.go +++ b/src/rest-api/handler/handler.go @@ -6,7 +6,6 @@ import ( "io" "log" "net/http" - "strings" "time" "github.com/jmoiron/sqlx" @@ -54,8 +53,8 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } func (h Handler) handleGet(w http.ResponseWriter, r *http.Request, user_id string) { - _, filePath, ok := strings.Cut(r.URL.Path, "/file/") - if !ok { + filePath := r.URL.Query().Get("path") + if filePath == "" { http.Error(w, "Invalid file path", http.StatusBadRequest) return } |