Skip to content

Commit

Permalink
fix uploading via a public link
Browse files Browse the repository at this point in the history
(cherry picked from commit 9228b67)
  • Loading branch information
2403905 authored and rhafer committed Apr 29, 2024
1 parent ddd52b1 commit 0f4d9a7
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/4666
https://github.com/cs3org/reva/pull/4589
https://github.com/owncloud/ocis/issues/8699
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 @@ -319,9 +319,15 @@ func (s *svc) handleTusPost(ctx context.Context, w http.ResponseWriter, r *http.
w.Header().Set(net.HeaderOCMtime, httpRes.Header.Get(net.HeaderOCMtime))
}

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,
}
}
}
finishUpload = httpRes.Header.Get(net.HeaderUploadOffset) == r.Header.Get(net.HeaderUploadLength)
Expand Down

0 comments on commit 0f4d9a7

Please sign in to comment.