Skip to content

Commit

Permalink
Merge pull request #3688 from kobergj/FixGET425
Browse files Browse the repository at this point in the history
Return 425 on ocdav GET
  • Loading branch information
kobergj authored Feb 27, 2023
2 parents 05a5fe9 + af0c5aa commit 78e8412
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 @@
Bugfix: Return 425 on GET

On ocdav 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 78e8412

Please sign in to comment.