Reply "insufficient storage" on disk full or over-quota

This commit will change the current behavior on disk-related errors:
* HTTP 507 "Insufficient storage" is the status on disk full or
over-quota
* HTTP 500 "Internal server error" on other disk-related errors
previously both were 400 "Bad request"
This commit is contained in:
Enrico204
2021-08-21 13:43:51 +02:00
parent d2813ea61b
commit 173bfb5371
2 changed files with 9 additions and 2 deletions

View File

@@ -75,7 +75,7 @@ func (m *Manager) WrapWriter(req *http.Request, w io.Writer) (io.Writer, int, er
if currentSize+contentLen > m.maxRepoSize {
err := fmt.Errorf("incoming blob (%d bytes) would exceed maximum size of repository (%d bytes)",
contentLen, m.maxRepoSize)
return nil, http.StatusRequestEntityTooLarge, err
return nil, http.StatusInsufficientStorage, err
}
}