forked from Deuxfleurs/bagage
Add some checks in my code
This commit is contained in:
parent
1c8e981df7
commit
c635462582
1 changed files with 11 additions and 0 deletions
11
s3_fs.go
11
s3_fs.go
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
@ -33,6 +34,16 @@ func NewS3FS(mc *minio.Client) S3FS {
|
|||
|
||||
func (s S3FS) Mkdir(ctx context.Context, name string, perm os.FileMode) error {
|
||||
s.ctx = ctx
|
||||
|
||||
p := NewS3Path(name)
|
||||
|
||||
if p.class == ROOT {
|
||||
return errors.New("Unable to create another root folder")
|
||||
} else if p.class == BUCKET {
|
||||
log.Println("Creating bucket is not implemented yet")
|
||||
return nil
|
||||
}
|
||||
|
||||
f, err := NewS3File(&s, path.Join(name, ".bagage"))
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue