mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
xl/CreateFile: handle errFileNameTooLong error properly (#1523)
When errFileNameTooLong error is returned from posix, xl.CreateFile() treats the error specially by returning the same error immediately. Fixes #1501
This commit is contained in:
@@ -19,6 +19,7 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@@ -678,6 +679,25 @@ func (s *MyAPIXLSuite) TestPutObject(c *C) {
|
||||
c.Assert(response.StatusCode, Equals, http.StatusOK)
|
||||
}
|
||||
|
||||
func (s *MyAPIXLSuite) TestPutObjectLongName(c *C) {
|
||||
request, err := s.newRequest("PUT", testAPIXLServer.URL+"/put-object-long-name", 0, nil)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
client := http.Client{}
|
||||
response, err := client.Do(request)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(response.StatusCode, Equals, http.StatusOK)
|
||||
|
||||
buffer := bytes.NewReader([]byte("hello world"))
|
||||
longObjName := fmt.Sprintf("%0256d", 1)
|
||||
request, err = s.newRequest("PUT", testAPIXLServer.URL+"/put-object-long-name/"+longObjName, int64(buffer.Len()), buffer)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
response, err = client.Do(request)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(response.StatusCode, Equals, http.StatusNotFound)
|
||||
}
|
||||
|
||||
func (s *MyAPIXLSuite) TestListBuckets(c *C) {
|
||||
request, err := s.newRequest("GET", testAPIXLServer.URL+"/", 0, nil)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
Reference in New Issue
Block a user