Skip to content

Commit

Permalink
return 425 on webdav GET
Browse files Browse the repository at this point in the history
Signed-off-by: jkoberg <[email protected]>
  • Loading branch information
kobergj committed Feb 27, 2023
1 parent 05a5fe9 commit 07f2ad1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-425-get.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugifix: Return 425 on GET

On webdab GET endpoint the server will now return `425` instead `500` when the file is being processed

https://github.com/cs3org/reva/pull/3688
6 changes: 6 additions & 0 deletions internal/http/services/owncloud/ocdav/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"github.com/cs3org/reva/v2/internal/http/services/owncloud/ocdav/spacelookup"
"github.com/cs3org/reva/v2/pkg/appctx"
"github.com/cs3org/reva/v2/pkg/rhttp"
"github.com/cs3org/reva/v2/pkg/utils"
"github.com/rs/zerolog"
)

Expand Down Expand Up @@ -78,6 +79,11 @@ func (s *svc) handleGet(ctx context.Context, w http.ResponseWriter, r *http.Requ
return
}

if status := utils.ReadPlainFromOpaque(sRes.GetInfo().GetOpaque(), "status"); status == "processing" {
w.WriteHeader(http.StatusTooEarly)
return
}

dReq := &provider.InitiateFileDownloadRequest{Ref: ref}
dRes, err := s.gwClient.InitiateFileDownload(ctx, dReq)
switch {
Expand Down

0 comments on commit 07f2ad1

Please sign in to comment.