Uploading a large file with an existing name shows "Network error" instead of the conflict/replace prompt
Version: v1.5.6-stable (Docker, arm64 / Raspberry Pi)
Steps to reproduce:
- Upload a file larger than the chunk size (e.g. a 23 MB file with the default 10 MB chunk size)
- Upload the same file again to the same folder
Expected: The upload is marked as a conflict and the replace prompt is offered.
Actual: The upload shows "Connection error: Network error. Click retry to resume." The server log shows 409 for the request, so the conflict is detected, but the browser never receives the response. Small files (below ~256 KB) show the conflict correctly.
Cause: In backend/http/resource.go (resourcePostHandler), the 409 responses are returned without reading the request body. When a large unread body (e.g. a 10 MB chunk) remains, Go's HTTP server closes the connection instead of draining it, so the XHR fires onerror ("Network error") and handleUploadError never sees err.response.status === 409.
Fix (tested locally on v1.5.6-stable): Drain the body before returning 409:
func uploadConflict(r *http.Request) (int, error) {
_, _ = io.Copy(io.Discard, r.Body)
return http.StatusConflict, nil
}and replace the five return http.StatusConflict, nil in resourcePostHandler with return uploadConflict(r). With this change, the conflict state and the replace button appear as intended.
Source: gtsteffaniak/filebrowser