Skip to content

Commit

Permalink
Merge pull request #4590 from 2403905/issue-8658
Browse files Browse the repository at this point in the history
[backport] Fix http error when uploading via a public link
  • Loading branch information
2403905 authored Mar 21, 2024
2 parents 29d7b81 + 396fc9d commit fd7b1a4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/fix-publiclink-upload.md
Original file line number Diff line number Diff line change
@@ -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
12 changes: 9 additions & 3 deletions internal/http/services/owncloud/ocdav/tus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
}

Expand Down

0 comments on commit fd7b1a4

Please sign in to comment.