diff --git a/cmd/dfs/cmd/server_test.go b/cmd/dfs/cmd/server_test.go index b1b873ab..00547bf4 100644 --- a/cmd/dfs/cmd/server_test.go +++ b/cmd/dfs/cmd/server_test.go @@ -1338,7 +1338,6 @@ func TestApis(t *testing.T) { if err != nil { t.Fatal(err) } - fmt.Println("uploadResp.StatusCode", uploadResp.StatusCode) if uploadResp.StatusCode != 200 { t.Fatal("upload failed") } diff --git a/pkg/api/dir_ls.go b/pkg/api/dir_ls.go index d28c7ad1..3efa182a 100644 --- a/pkg/api/dir_ls.go +++ b/pkg/api/dir_ls.go @@ -51,7 +51,7 @@ type ListFileResponse struct { func (h *Handler) DirectoryLsHandler(w http.ResponseWriter, r *http.Request) { driveName, isGroup := "", false keys, ok := r.URL.Query()["groupName"] - if ok || len(keys[0]) > 0 { + if ok || (len(keys) == 1 && len(keys[0]) > 0) { driveName = keys[0] isGroup = true } else { diff --git a/pkg/api/dir_present.go b/pkg/api/dir_present.go index 29f923b2..031668df 100644 --- a/pkg/api/dir_present.go +++ b/pkg/api/dir_present.go @@ -47,7 +47,7 @@ type DirPresentResponse struct { func (h *Handler) DirectoryPresentHandler(w http.ResponseWriter, r *http.Request) { driveName, isGroup := "", false keys, ok := r.URL.Query()["groupName"] - if ok || len(keys[0]) > 0 { + if ok || (len(keys) == 1 && len(keys[0]) > 0) { driveName = keys[0] isGroup = true } else { diff --git a/pkg/api/dir_stat.go b/pkg/api/dir_stat.go index 95749807..2eb1c26e 100644 --- a/pkg/api/dir_stat.go +++ b/pkg/api/dir_stat.go @@ -45,7 +45,7 @@ import ( func (h *Handler) DirectoryStatHandler(w http.ResponseWriter, r *http.Request) { driveName, isGroup := "", false keys, ok := r.URL.Query()["groupName"] - if ok || len(keys[0]) > 0 { + if ok || (len(keys) == 1 && len(keys[0]) > 0) { driveName = keys[0] isGroup = true } else { diff --git a/pkg/api/file_download.go b/pkg/api/file_download.go index a5558927..066e5704 100644 --- a/pkg/api/file_download.go +++ b/pkg/api/file_download.go @@ -46,7 +46,7 @@ import ( func (h *Handler) FileDownloadHandlerPost(w http.ResponseWriter, r *http.Request) { driveName, isGroup := "", false keys, ok := r.URL.Query()["groupName"] - if ok || len(keys[0]) > 0 { + if ok || (len(keys) == 1 && len(keys[0]) > 0) { driveName = keys[0] isGroup = true } else { @@ -92,7 +92,7 @@ func (h *Handler) FileDownloadHandlerPost(w http.ResponseWriter, r *http.Request func (h *Handler) FileDownloadHandlerGet(w http.ResponseWriter, r *http.Request) { driveName, isGroup := "", false keys, ok := r.URL.Query()["groupName"] - if ok || len(keys[0]) > 0 { + if ok || (len(keys) == 1 && len(keys[0]) > 0) { driveName = keys[0] isGroup = true } else { diff --git a/pkg/api/file_stat.go b/pkg/api/file_stat.go index 6068fd2f..723cea66 100644 --- a/pkg/api/file_stat.go +++ b/pkg/api/file_stat.go @@ -45,7 +45,7 @@ import ( func (h *Handler) FileStatHandler(w http.ResponseWriter, r *http.Request) { driveName, isGroup := "", false keys, ok := r.URL.Query()["groupName"] - if ok || len(keys[0]) > 0 { + if ok || (len(keys) == 1 && len(keys[0]) > 0) { driveName = keys[0] isGroup = true } else { diff --git a/pkg/api/file_status.go b/pkg/api/file_status.go index b34f715c..56d5c6ee 100644 --- a/pkg/api/file_status.go +++ b/pkg/api/file_status.go @@ -36,7 +36,7 @@ type StatusResponse struct { func (h *Handler) FileStatusHandler(w http.ResponseWriter, r *http.Request) { driveName, isGroup := "", false keys, ok := r.URL.Query()["groupName"] - if ok || len(keys[0]) > 0 { + if ok || (len(keys) == 1 && len(keys[0]) > 0) { driveName = keys[0] isGroup = true } else {