mirror of
https://github.com/minio/minio.git
synced 2025-11-20 18:06:10 -05:00
api/handlers: Implement streaming signature v4 support. (#2370)
* api/handlers: Implement streaming signature v4 support. Fixes #2326 * tests: Add tests for quick/safe
This commit is contained in:
@@ -35,14 +35,14 @@ type File struct {
|
||||
|
||||
// Write writes len(b) bytes to the temporary File. In case of error, the temporary file is removed.
|
||||
func (file *File) Write(b []byte) (n int, err error) {
|
||||
if file.aborted {
|
||||
err = errors.New("write on aborted file")
|
||||
return
|
||||
}
|
||||
if file.closed {
|
||||
err = errors.New("write on closed file")
|
||||
return
|
||||
}
|
||||
if file.aborted {
|
||||
err = errors.New("write on aborted file")
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@@ -64,7 +64,12 @@ func (file *File) Close() (err error) {
|
||||
}
|
||||
}()
|
||||
|
||||
if file.aborted || file.closed {
|
||||
if file.closed {
|
||||
err = errors.New("close on closed file")
|
||||
return
|
||||
}
|
||||
if file.aborted {
|
||||
err = errors.New("close on aborted file")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -80,7 +85,12 @@ func (file *File) Close() (err error) {
|
||||
|
||||
// Abort aborts the temporary File by closing and removing the temporary file.
|
||||
func (file *File) Abort() (err error) {
|
||||
if file.aborted || file.closed {
|
||||
if file.closed {
|
||||
err = errors.New("abort on closed file")
|
||||
return
|
||||
}
|
||||
if file.aborted {
|
||||
err = errors.New("abort on aborted file")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user