Skip to content

Commit

Permalink
fix response body when creating folder with existing name (#1907)
Browse files Browse the repository at this point in the history
  • Loading branch information
David Christofas authored Jul 22, 2021
1 parent eacfd6a commit 4f56ad9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 24 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/error-mkcol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Error when creating folder with existing name

When a user tried to create a folder with the name of an existing file or folder the service didn't return a response body containing the error.

https://github.com/cs3org/reva/pull/1907
5 changes: 5 additions & 0 deletions internal/http/services/owncloud/ocdav/mkcol.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ func (s *svc) handleMkcol(ctx context.Context, w http.ResponseWriter, r *http.Re
if statRes.Status.Code != rpc.Code_CODE_NOT_FOUND {
if statRes.Status.Code == rpc.Code_CODE_OK {
w.WriteHeader(http.StatusMethodNotAllowed) // 405 if it already exists
b, err := Marshal(exception{
code: SabredavMethodNotAllowed,
message: "The resource you tried to create already exists",
})
HandleWebdavError(&log, w, b, err)
} else {
HandleErrorStatus(&log, w, statRes.Status)
}
Expand Down
8 changes: 0 additions & 8 deletions tests/acceptance/expected-failures-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ Basic file management like up and download, move, copy, properties, quota, trash
- [apiWebdavProperties1/copyFile.feature:340](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L340)
- [apiWebdavProperties1/copyFile.feature:341](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L341)

#### [creating a folder that already exists returns an empty body](https://github.com/owncloud/ocis/issues/1283)
Scenario Outline: try to create a folder that already exists
- [apiWebdavProperties1/createFolder.feature:85](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L85)
- [apiWebdavProperties1/createFolder.feature:86](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L86)
Scenario Outline: try to create a folder with a name of an existing file
- [apiWebdavProperties1/createFolder.feature:99](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L99)
- [apiWebdavProperties1/createFolder.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L100)

### [Different webdav properties from core](https://github.com/owncloud/ocis/issues/1302)
- [apiWebdavProperties2/getFileProperties.feature:327](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L327)
- [apiWebdavProperties2/getFileProperties.feature:328](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L328)
Expand Down
8 changes: 0 additions & 8 deletions tests/acceptance/expected-failures-on-OWNCLOUD-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,6 @@ The following scenarios fail on OWNCLOUD storage but not on OCIS storage:
- [apiWebdavProperties1/copyFile.feature:170](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L170)
- [apiWebdavProperties1/copyFile.feature:171](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L171)

#### [creating a folder that already exists returns an empty body](https://github.com/owncloud/ocis/issues/1283)
Scenario Outline: try to create a folder that already exists
- [apiWebdavProperties1/createFolder.feature:85](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L85)
- [apiWebdavProperties1/createFolder.feature:86](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L86)
Scenario Outline: try to create a folder with a name of an existing file
- [apiWebdavProperties1/createFolder.feature:99](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L99)
- [apiWebdavProperties1/createFolder.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L100)

### [Different webdav properties from core](https://github.com/owncloud/ocis/issues/1302)
Scenario Outline: Propfind the content type of a file using webdav api `Property "d:getcontenttype" found with value "text/plain; charset=utf-8", expected "#^text/plain$#" or "#^text/plain$#"`
- [apiWebdavProperties2/getFileProperties.feature:327](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L327)
Expand Down
8 changes: 0 additions & 8 deletions tests/acceptance/expected-failures-on-S3NG-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,6 @@ Basic file management like up and download, move, copy, properties, quota, trash
- [apiWebdavProperties1/copyFile.feature:340](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L340)
- [apiWebdavProperties1/copyFile.feature:341](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/copyFile.feature#L341)

#### [creating a folder that already exists returns an empty body](https://github.com/owncloud/ocis/issues/1283)
Scenario Outline: try to create a folder that already exists
- [apiWebdavProperties1/createFolder.feature:85](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L85)
- [apiWebdavProperties1/createFolder.feature:86](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L86)
Scenario Outline: try to create a folder with a name of an existing file
- [apiWebdavProperties1/createFolder.feature:99](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L99)
- [apiWebdavProperties1/createFolder.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties1/createFolder.feature#L100)

### [Different webdav properties from core](https://github.com/owncloud/ocis/issues/1302)
- [apiWebdavProperties2/getFileProperties.feature:327](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L327)
- [apiWebdavProperties2/getFileProperties.feature:328](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavProperties2/getFileProperties.feature#L328)
Expand Down

0 comments on commit 4f56ad9

Please sign in to comment.