From 1c8e981df792a512667bc0553d30f4b069febb4b Mon Sep 17 00:00:00 2001 From: Quentin Date: Mon, 23 Aug 2021 21:55:52 +0200 Subject: [PATCH] Add support for directory creation --- auth_ldap.go | 2 +- s3_fs.go | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/auth_ldap.go b/auth_ldap.go index 9164e93..bf2a9fb 100644 --- a/auth_ldap.go +++ b/auth_ldap.go @@ -101,7 +101,7 @@ func (l *ldapConnector) profile() (*ldap.Entry, error) { } if len(sr.Entries) != 1 { - return nil, errors.New(fmt.Sprintf("Wrong number of LDAP entries, expected 1, got", len(sr.Entries))) + return nil, errors.New(fmt.Sprintf("Wrong number of LDAP entries, expected 1, got %d", len(sr.Entries))) } return sr.Entries[0], nil diff --git a/s3_fs.go b/s3_fs.go index ecade9f..923240e 100644 --- a/s3_fs.go +++ b/s3_fs.go @@ -3,7 +3,10 @@ package main import ( "context" "errors" + "io" "os" + "path" + "strings" "time" "github.com/minio/minio-go/v7" @@ -30,7 +33,14 @@ func NewS3FS(mc *minio.Client) S3FS { func (s S3FS) Mkdir(ctx context.Context, name string, perm os.FileMode) error { s.ctx = ctx - return errors.New("Not implemented Mkdir") + f, err := NewS3File(&s, path.Join(name, ".bagage")) + if err != nil { + return err + } + defer f.Close() + + _, err = io.Copy(f, strings.NewReader("This is a placeholder")) + return nil } func (s S3FS) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error) {