Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix listing shares for nonexisting path #1316

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix listing shares for nonexisting path

When trying to list shares for a not existing file or folder the ocs sharing implementation no longer responds with the wrong status code and broken xml.

https://github.com/cs3org/reva/pull/1316
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ func (h *Handler) listSharesWithOthers(w http.ResponseWriter, r *http.Request) {

filters, linkFilters, err = h.addFilters(w, r, hRes.GetPath())
if err != nil {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, err.Error(), err)
// result has been written as part of addFilters
return
}
}
Expand Down Expand Up @@ -921,12 +921,13 @@ func (h *Handler) addFilters(w http.ResponseWriter, r *http.Request, prefix stri
}

if res.Status.Code != rpc.Code_CODE_OK {
err = errors.New(res.Status.Message)
if res.Status.Code == rpc.Code_CODE_NOT_FOUND {
response.WriteOCSError(w, r, response.MetaNotFound.StatusCode, "not found", nil)
return collaborationFilters, linkFilters, errors.New("fixme")
response.WriteOCSError(w, r, response.MetaNotFound.StatusCode, "not found", err)
return nil, nil, err
}
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "grpc stat request failed", err)
return collaborationFilters, linkFilters, errors.New("fixme")
return nil, nil, err
}

info = res.Info
Expand Down