Skip to content

Commit

Permalink
fix trashbin listing with depth 0 (#1956)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Christofas authored Aug 5, 2021
1 parent 63bbab9 commit 3ace8fd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-trashbin-listing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix trashbin listing with depth 0

The trashbin API handled requests with depth 0 the same as request with a depth of 1.

https://github.com/cs3org/reva/pull/1956
18 changes: 18 additions & 0 deletions internal/http/services/owncloud/ocdav/trashbin.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,24 @@ func (h *TrashbinHandler) listTrashbin(w http.ResponseWriter, r *http.Request, s
return
}

if depth == "0" {
propRes, err := h.formatTrashPropfind(ctx, s, u, nil, nil)
if err != nil {
sublog.Error().Err(err).Msg("error formatting propfind")
w.WriteHeader(http.StatusInternalServerError)
return
}
w.Header().Set(HeaderDav, "1, 3, extended-mkcol")
w.Header().Set(HeaderContentType, "application/xml; charset=utf-8")
w.WriteHeader(http.StatusMultiStatus)
_, err = w.Write([]byte(propRes))
if err != nil {
sublog.Error().Err(err).Msg("error writing body")
return
}
return
}

pf, status, err := readPropfind(r.Body)
if err != nil {
sublog.Debug().Err(err).Msg("error reading propfind request")
Expand Down
3 changes: 0 additions & 3 deletions tests/acceptance/expected-failures-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ Basic file management like up and download, move, copy, properties, quota, trash
- [apiTrashbin/trashbinFilesFolders.feature:230](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature#L230)
- [apiTrashbin/trashbinFilesFolders.feature:231](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature#L231)

#### [PROPFIND on trashbin with Depth: infinity only shows the first level](https://github.com/owncloud/ocis/issues/1116)
- [apiWebdavOperations/listFiles.feature:182](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavOperations/listFiles.feature#L182)

#### [Implement Versions Feature for ocis storage](https://github.com/owncloud/product/issues/210)
- [apiWebdavEtagPropagation2/restoreVersion.feature:10](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation2/restoreVersion.feature#L10)

Expand Down
3 changes: 0 additions & 3 deletions tests/acceptance/expected-failures-on-S3NG-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ Basic file management like up and download, move, copy, properties, quota, trash
- [apiTrashbin/trashbinFilesFolders.feature:230](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature#L230)
- [apiTrashbin/trashbinFilesFolders.feature:231](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature#L231)

#### [PROPFIND on trashbin with Depth: infinity only shows the first level](https://github.com/owncloud/ocis/issues/1116)
- [apiWebdavOperations/listFiles.feature:182](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavOperations/listFiles.feature#L182)

#### [downloading an old version of a file returns 501](https://github.com/owncloud/ocis/issues/2261)
- [apiVersions/fileVersions.feature:437](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L437)
- [apiVersions/fileVersions.feature:455](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiVersions/fileVersions.feature#L455)
Expand Down

0 comments on commit 3ace8fd

Please sign in to comment.