Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
asabya committed Feb 19, 2024
1 parent a837537 commit 0615bc1
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 8 deletions.
1 change: 0 additions & 1 deletion cmd/dfs/cmd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/dir_ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/dir_present.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/dir_stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/api/file_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/file_stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/file_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0615bc1

Please sign in to comment.