From c0594d6f802af3fda11e7a937b44ebaf9c851d77 Mon Sep 17 00:00:00 2001 From: Sawjan Gurung Date: Tue, 17 Oct 2023 14:53:47 +0545 Subject: [PATCH] fix: request to preview gives 500 error for old/new webdav if file is in processing (#7507) * fix: request to preview gives 500 error for old/new webdav if file is in processing * add changelog --- changelog/unreleased/fix-too-early-preview-request.md | 6 ++++++ services/webdav/pkg/service/v0/service.go | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/fix-too-early-preview-request.md diff --git a/changelog/unreleased/fix-too-early-preview-request.md b/changelog/unreleased/fix-too-early-preview-request.md new file mode 100644 index 0000000000..22f77b3b9a --- /dev/null +++ b/changelog/unreleased/fix-too-early-preview-request.md @@ -0,0 +1,6 @@ +Bugfix: Fix preview request 500 error when made too early + +Fix the status code and message when a thumbnail request is made too early. + +https://github.com/owncloud/ocis/issues/7502 +https://github.com/owncloud/ocis/pull/7507 diff --git a/services/webdav/pkg/service/v0/service.go b/services/webdav/pkg/service/v0/service.go index b1655c2b8c..cbe3a74f5a 100644 --- a/services/webdav/pkg/service/v0/service.go +++ b/services/webdav/pkg/service/v0/service.go @@ -260,7 +260,7 @@ func (g Webdav) SpacesThumbnail(w http.ResponseWriter, r *http.Request) { return case http.StatusTooEarly: // StatusTooEarly if file is processing - renderError(w, r, errTooEarly(err.Error())) + renderError(w, r, errTooEarly(e.Detail)) return case http.StatusBadRequest: renderError(w, r, errBadRequest(e.Detail)) @@ -351,6 +351,10 @@ func (g Webdav) Thumbnail(w http.ResponseWriter, r *http.Request) { // StatusNotFound is expected for unsupported files renderError(w, r, errNotFound(notFoundMsg(tr.Filename))) return + case http.StatusTooEarly: + // StatusTooEarly if file is processing + renderError(w, r, errTooEarly(e.Detail)) + return case http.StatusBadRequest: renderError(w, r, errBadRequest(e.Detail)) default: