aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2021-08-23 22:00:55 +0200
committerQuentin <quentin@deuxfleurs.fr>2021-08-23 22:00:55 +0200
commitc63546258287116a7502ee3322f4480c7fcd292b (patch)
tree717dc8127ff78e3ee683b7ce5b87c2e28a4c9da8
parent1c8e981df792a512667bc0553d30f4b069febb4b (diff)
downloadbagage-c63546258287116a7502ee3322f4480c7fcd292b.tar.gz
bagage-c63546258287116a7502ee3322f4480c7fcd292b.zip
Add some checks in my code
-rw-r--r--s3_fs.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/s3_fs.go b/s3_fs.go
index 923240e..afc55b7 100644
--- a/s3_fs.go
+++ b/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