diff --git a/changelog/unreleased/fix-publiclink-upload.md b/changelog/unreleased/fix-publiclink-upload.md new file mode 100644 index 0000000000..9f29aba604 --- /dev/null +++ b/changelog/unreleased/fix-publiclink-upload.md @@ -0,0 +1,7 @@ +Bugfix: Fix uploading via a public link + +Fix http error when uploading via a public link + +https://github.com/cs3org/reva/pull/4590 +https://github.com/owncloud/ocis/issues/8658 +https://github.com/owncloud/ocis/issues/8629 diff --git a/internal/http/services/owncloud/ocdav/tus.go b/internal/http/services/owncloud/ocdav/tus.go index 84a3515edd..36c6eb7861 100644 --- a/internal/http/services/owncloud/ocdav/tus.go +++ b/internal/http/services/owncloud/ocdav/tus.go @@ -291,9 +291,15 @@ func (s *svc) handleTusPost(ctx context.Context, w http.ResponseWriter, r *http. if length == 0 || httpRes.Header.Get(net.HeaderUploadOffset) == r.Header.Get(net.HeaderUploadLength) { // get uploaded file metadata - if resid, err := storagespace.ParseID(httpRes.Header.Get(net.HeaderOCFileID)); err == nil { - sReq.Ref = &provider.Reference{ - ResourceId: &resid, + if strings.HasPrefix(uReq.GetRef().GetPath(), "/public") && uReq.GetRef().GetResourceId() == nil { + // Use the path based request for the public link + sReq.Ref.Path = uReq.Ref.GetPath() + sReq.Ref.ResourceId = nil + } else { + if resid, err := storagespace.ParseID(httpRes.Header.Get(net.HeaderOCFileID)); err == nil { + sReq.Ref = &provider.Reference{ + ResourceId: &resid, + } } }