Skip to content

Commit

Permalink
test valid filename on spaces tus upload
Browse files Browse the repository at this point in the history
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
  • Loading branch information
butonic committed Jul 11, 2022
1 parent 047ab30 commit 00e75df
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 @@ -1362,11 +1362,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 @@ -1365,11 +1365,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 00e75df

Please sign in to comment.