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:
Bala FA
2016-05-12 01:25:02 +05:30
committed by Harshavardhana
parent 86e5d71519
commit adbcafefad
5 changed files with 88 additions and 0 deletions
+20
View File
@@ -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)