mirror of
https://github.com/minio/minio.git
synced 2024-12-23 21:55:53 -05:00
Return info for DiskInfo when the disk is unformatted (#14427)
In a distributed setup, a DiskInfo REST call to an unformatted disk returns an error with no disk information, such as the disk endpoint URL, which is unexpected.
This commit is contained in:
parent
b030ef1aca
commit
4a15bd8ff8
@ -109,7 +109,7 @@ func storageServerRequestValidate(r *http.Request) error {
|
||||
}
|
||||
|
||||
// IsValid - To authenticate and verify the time difference.
|
||||
func (s *storageRESTServer) IsValid(w http.ResponseWriter, r *http.Request) bool {
|
||||
func (s *storageRESTServer) IsAuthValid(w http.ResponseWriter, r *http.Request) bool {
|
||||
if s.storage == nil {
|
||||
s.writeErrorResponse(w, errDiskNotFound)
|
||||
return false
|
||||
@ -120,6 +120,15 @@ func (s *storageRESTServer) IsValid(w http.ResponseWriter, r *http.Request) bool
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// IsValid - To authenticate and check if the disk-id in the request corresponds to the underlying disk.
|
||||
func (s *storageRESTServer) IsValid(w http.ResponseWriter, r *http.Request) bool {
|
||||
if !s.IsAuthValid(w, r) {
|
||||
return false
|
||||
}
|
||||
|
||||
if err := r.ParseForm(); err != nil {
|
||||
s.writeErrorResponse(w, err)
|
||||
return false
|
||||
@ -155,7 +164,7 @@ func (s *storageRESTServer) HealthHandler(w http.ResponseWriter, r *http.Request
|
||||
|
||||
// DiskInfoHandler - returns disk info.
|
||||
func (s *storageRESTServer) DiskInfoHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if !s.IsValid(w, r) {
|
||||
if !s.IsAuthValid(w, r) {
|
||||
return
|
||||
}
|
||||
info, err := s.storage.DiskInfo(r.Context())
|
||||
|
Loading…
Reference in New Issue
Block a user