Check pathlength before reading metadata (#13080)

fixes bug where the server returns 503 instead of 400 if 
objectName is longer than 255 characters

Fixes regression introduced in #12942
This commit is contained in:
Poorna Krishnamoorthy
2021-08-26 19:23:12 -04:00
committed by GitHub
parent c11a2ac396
commit 27f895cf2c
2 changed files with 24 additions and 0 deletions

View File

@@ -397,6 +397,10 @@ func (s *xlStorage) Healing() *healingTracker {
}
func (s *xlStorage) readMetadata(itemPath string) ([]byte, error) {
if err := checkPathLength(itemPath); err != nil {
return nil, err
}
f, err := OpenFile(itemPath, readMode, 0)
if err != nil {
return nil, err