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

Indicate in EOS containers that TUS is not supported #1415

Merged
merged 2 commits into from
Jan 21, 2021
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
8 changes: 8 additions & 0 deletions changelog/unreleased/eos-disable-tus.md
Original file line number Diff line number Diff line change
@@ -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
15 changes: 11 additions & 4 deletions internal/http/services/owncloud/ocdav/propfind.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions pkg/storage/utils/eosfs/eosfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down