Skip to content

Commit

Permalink
test valid filename on spaces tus upload (#3067)
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
  • Loading branch information
butonic authored Jul 12, 2022
1 parent f26e19f commit 3be25cf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
6 changes: 6 additions & 0 deletions changelog/unreleased/test-valid-filename-on-spaces-tus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: test valid filename on spaces tus upload

Tus uploads in spaces now also test valid filenames.

https://github.com/cs3org/reva/pull/2977
https://github.com/owncloud/ocis/issues/3050
8 changes: 5 additions & 3 deletions internal/http/services/owncloud/ocdav/tus.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ func (s *svc) handleSpacesTusPost(w http.ResponseWriter, r *http.Request, spaceI

// read filename from metadata
meta := tusd.ParseMetadataHeader(r.Header.Get(net.HeaderUploadMetadata))
if meta["filename"] == "" {
w.WriteHeader(http.StatusPreconditionFailed)
return
for _, r := range nameRules {
if !r.Test(meta["filename"]) {
w.WriteHeader(http.StatusPreconditionFailed)
return
}
}

sublog := appctx.GetLogger(ctx).With().Str("spaceid", spaceID).Str("path", r.URL.Path).Logger()
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 @@ -1360,11 +1360,6 @@ moving outside of the Shares folder gives 501 Not Implemented.
- [apiShareManagementToShares/moveShareInsideAnotherShare.feature:86](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementToShares/moveShareInsideAnotherShare.feature#L86)
- [apiShareManagementToShares/moveShareInsideAnotherShare.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementToShares/moveShareInsideAnotherShare.feature#L100)

#### [TUS upload file with invalid name sends false response](https://github.com/owncloud/ocis/issues/3050)
- [apiWebdavUploadTUS/uploadFile.feature:215](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFile.feature#L215)
- [apiWebdavUploadTUS/uploadFile.feature:216](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFile.feature#L216)
- [apiWebdavUploadTUS/uploadFile.feature:218](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFile.feature#L218)

#### [unable to create resource using TUS inside Shares dir](https://github.com/owncloud/ocis/issues/3048)
- [apiWebdavUploadTUS/uploadFileMtimeShares.feature:33](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFileMtimeShares.feature#L33)
- [apiWebdavUploadTUS/uploadFileMtimeShares.feature:52](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFileMtimeShares.feature#L52)
Expand Down
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 @@ -1363,11 +1363,6 @@ _ocs: api compatibility, return correct status code_
- [apiShareManagementToShares/moveShareInsideAnotherShare.feature:86](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementToShares/moveShareInsideAnotherShare.feature#L86)
- [apiShareManagementToShares/moveShareInsideAnotherShare.feature:100](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementToShares/moveShareInsideAnotherShare.feature#L100)

#### [TUS upload file with invalid name sends false response](https://github.com/owncloud/ocis/issues/3050)
- [apiWebdavUploadTUS/uploadFile.feature:215](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFile.feature#L215)
- [apiWebdavUploadTUS/uploadFile.feature:216](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFile.feature#L216)
- [apiWebdavUploadTUS/uploadFile.feature:218](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFile.feature#L218)

#### [unable to create resource using TUS inside Shares dir](https://github.com/owncloud/ocis/issues/3048)
- [apiWebdavUploadTUS/uploadFileMtimeShares.feature:33](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFileMtimeShares.feature#L33)
- [apiWebdavUploadTUS/uploadFileMtimeShares.feature:52](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadFileMtimeShares.feature#L52)
Expand Down

0 comments on commit 3be25cf

Please sign in to comment.