From a801332b0dc44ea3239e437b845e210c840e125e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 24 Mar 2021 01:03:11 -0700 Subject: [PATCH] filer: return 409 if file conflicts with a directory fix https://github.com/chrislusf/seaweedfs/issues/1938 --- weed/server/filer_server_handlers_write_autochunk.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go index b990f6488..b44dc381a 100644 --- a/weed/server/filer_server_handlers_write_autochunk.go +++ b/weed/server/filer_server_handlers_write_autochunk.go @@ -59,6 +59,8 @@ func (fs *FilerServer) autoChunk(ctx context.Context, w http.ResponseWriter, r * if err != nil { if strings.HasPrefix(err.Error(), "read input:") { writeJsonError(w, r, 499, err) + }else if strings.HasSuffix(err.Error(), "is a file") { + writeJsonError(w, r, http.StatusConflict, err) } else { writeJsonError(w, r, http.StatusInternalServerError, err) }