diff --git a/changelog/unreleased/eos-disable-tus.md b/changelog/unreleased/eos-disable-tus.md new file mode 100644 index 0000000000..03a81a4ddb --- /dev/null +++ b/changelog/unreleased/eos-disable-tus.md @@ -0,0 +1,8 @@ +Enhancement: Indicate in EOS containers that TUS is not supported + +The OCDAV propfind response previously hardcoded the TUS headers due to which +clients such as phoenix used the TUS protocol for uploads, which EOS doesn't +support. Now we pass this property as an opaque entry in the containers +metadata. + +https://github.com/cs3org/reva/pull/1415 diff --git a/internal/http/services/owncloud/ocdav/propfind.go b/internal/http/services/owncloud/ocdav/propfind.go index c56bb11bfb..bb224b5220 100644 --- a/internal/http/services/owncloud/ocdav/propfind.go +++ b/internal/http/services/owncloud/ocdav/propfind.go @@ -188,12 +188,19 @@ func (s *svc) handlePropfind(w http.ResponseWriter, r *http.Request, ns string) } w.Header().Set("DAV", "1, 3, extended-mkcol") w.Header().Set("Content-Type", "application/xml; charset=utf-8") + + var disableTus bool // let clients know this collection supports tus.io POST requests to start uploads if info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER { - w.Header().Add("Access-Control-Expose-Headers", "Tus-Resumable, Tus-Version, Tus-Extension") - w.Header().Set("Tus-Resumable", "1.0.0") - w.Header().Set("Tus-Version", "1.0.0") - w.Header().Set("Tus-Extension", "creation,creation-with-upload") + if info.Opaque != nil { + _, disableTus = info.Opaque.Map["disable_tus"] + } + if !disableTus { + w.Header().Add("Access-Control-Expose-Headers", "Tus-Resumable, Tus-Version, Tus-Extension") + w.Header().Set("Tus-Resumable", "1.0.0") + w.Header().Set("Tus-Version", "1.0.0") + w.Header().Set("Tus-Extension", "creation,creation-with-upload") + } } w.WriteHeader(http.StatusMultiStatus) if _, err := w.Write([]byte(propRes)); err != nil { diff --git a/pkg/storage/utils/eosfs/eosfs.go b/pkg/storage/utils/eosfs/eosfs.go index 5dbcddaac1..0a7165c5a4 100644 --- a/pkg/storage/utils/eosfs/eosfs.go +++ b/pkg/storage/utils/eosfs/eosfs.go @@ -1409,6 +1409,13 @@ func (fs *eosfs) convert(ctx context.Context, eosFileInfo *eosclient.FileInfo) ( }, } + if eosFileInfo.IsDir { + info.Opaque.Map["disable_tus"] = &types.OpaqueEntry{ + Decoder: "plain", + Value: []byte("true"), + } + } + info.Type = getResourceType(eosFileInfo.IsDir) return info, nil }