return 425 on thumbnails when file is processing

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2022-12-28 15:40:35 +01:00
parent 37b5474b4d
commit 48ffc19554
2 changed files with 18 additions and 0 deletions
@@ -245,6 +245,10 @@ func (g Webdav) SpacesThumbnail(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(err.Error()))
return
case http.StatusBadRequest:
renderError(w, r, errBadRequest(err.Error()))
default:
@@ -508,6 +512,10 @@ func errNotFound(msg string) *errResponse {
return newErrResponse(http.StatusNotFound, msg)
}
func errTooEarly(msg string) *errResponse {
return newErrResponse(http.StatusTooEarly, msg)
}
func renderError(w http.ResponseWriter, r *http.Request, err *errResponse) {
render.Status(r, err.HTTPStatusCode)
render.XML(w, r, err)