s3/local backend: Fix error for overwriting files
This commit is contained in:
parent
1547d3b656
commit
d9c87559b5
2 changed files with 16 additions and 5 deletions
|
@ -2,6 +2,7 @@ package s3
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
|
@ -103,6 +104,13 @@ func (be S3Backend) Save(h backend.Handle, p []byte) (err error) {
|
|||
|
||||
path := s3path(h.Type, h.Name)
|
||||
|
||||
// Check key does not already exist
|
||||
_, err = be.client.StatObject(be.bucketname, path)
|
||||
if err == nil {
|
||||
debug.Log("s3.blob.Finalize()", "%v already exists", h)
|
||||
return errors.New("key already exists")
|
||||
}
|
||||
|
||||
<-be.connChan
|
||||
defer func() {
|
||||
be.connChan <- struct{}{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue