Add support for directory creation

This commit is contained in:
Quentin 2021-08-23 21:55:52 +02:00
parent 15e4d10fd4
commit 1c8e981df7
2 changed files with 12 additions and 2 deletions

View file

@ -101,7 +101,7 @@ func (l *ldapConnector) profile() (*ldap.Entry, error) {
} }
if len(sr.Entries) != 1 { 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 return sr.Entries[0], nil

View file

@ -3,7 +3,10 @@ package main
import ( import (
"context" "context"
"errors" "errors"
"io"
"os" "os"
"path"
"strings"
"time" "time"
"github.com/minio/minio-go/v7" "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 { func (s S3FS) Mkdir(ctx context.Context, name string, perm os.FileMode) error {
s.ctx = ctx 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) { func (s S3FS) OpenFile(ctx context.Context, name string, flag int, perm os.FileMode) (webdav.File, error) {