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 conflict response code #3031

Merged
merged 2 commits into from
Jul 5, 2022
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
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-response-code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Return proper response code when detecting recursive copy/move operations

We changed the ocdav response code to "409 - Conflict" when a recursive operation was detected.

https://github.com/cs3org/reva/pull/3031
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ func (s *svc) prepareCopy(ctx context.Context, w http.ResponseWriter, r *http.Re
}
}
if isChild {
w.WriteHeader(http.StatusBadRequest)
w.WriteHeader(http.StatusConflict)
b, err := errors.Marshal(http.StatusBadRequest, "can not copy a folder into one of its children", "")
errors.HandleWebdavError(log, w, b, err)
return nil
Expand Down
2 changes: 1 addition & 1 deletion internal/http/services/owncloud/ocdav/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (s *svc) handleMove(ctx context.Context, w http.ResponseWriter, r *http.Req
}
}
if isChild {
w.WriteHeader(http.StatusBadRequest)
w.WriteHeader(http.StatusConflict)
b, err := errors.Marshal(http.StatusBadRequest, "can not move a folder into one of its children", "")
errors.HandleWebdavError(&log, w, b, err)
return
Expand Down
5 changes: 0 additions & 5 deletions tests/acceptance/expected-failures-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -1490,10 +1490,5 @@ moving outside of the Shares folder gives 501 Not Implemented.
- [apiShareOperationsToShares1/gettingShares.feature:40](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/gettingShares.feature#L40)
- [apiShareOperationsToShares1/gettingShares.feature:39](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/gettingShares.feature#L39)

#### [apiWebdavMove1/moveFolder.feature:135 fails with 400 status](https://github.com/owncloud/ocis/issues/3023)
- [apiWebdavMove1/moveFolder.feature:147](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove1/moveFolder.feature#L147)
- [apiWebdavMove1/moveFolder.feature:148](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove1/moveFolder.feature#L148)
- [apiWebdavMove1/moveFolder.feature:153](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove1/moveFolder.feature#L153)

- Note: always have an empty line at the end of this file.
The bash script that processes this file may not process a scenario reference on the last line.
5 changes: 0 additions & 5 deletions tests/acceptance/expected-failures-on-S3NG-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -1488,10 +1488,5 @@ _ocs: api compatibility, return correct status code_
- [apiShareOperationsToShares1/gettingShares.feature:40](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/gettingShares.feature#L40)
- [apiShareOperationsToShares1/gettingShares.feature:39](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareOperationsToShares1/gettingShares.feature#L39)

#### [apiWebdavMove1/moveFolder.feature:135 fails with 400 status](https://github.com/owncloud/ocis/issues/3023)
- [apiWebdavMove1/moveFolder.feature:147](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove1/moveFolder.feature#L147)
- [apiWebdavMove1/moveFolder.feature:148](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove1/moveFolder.feature#L148)
- [apiWebdavMove1/moveFolder.feature:153](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavMove1/moveFolder.feature#L153)

Note: always have an empty line at the end of this file.
The bash script that processes this file may not process a scenario reference on the last line.