Skip to content

Commit 68433d4

Browse files
authored
fix(local): cannot mkdir on specific platforms (#1304)
1 parent cc16cb3 commit 68433d4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/local/driver.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func (d *Local) Config() driver.Config {
5151

5252
func (d *Local) Init(ctx context.Context) error {
5353
if d.MkdirPerm == "" {
54-
d.mkdirPerm = 0777
54+
d.mkdirPerm = 0o777
5555
} else {
5656
v, err := strconv.ParseUint(d.MkdirPerm, 8, 32)
5757
if err != nil {
@@ -150,6 +150,7 @@ func (d *Local) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([
150150
}
151151
return files, nil
152152
}
153+
153154
func (d *Local) FileInfoToObj(ctx context.Context, f fs.FileInfo, reqPath string, fullPath string) model.Obj {
154155
thumb := ""
155156
if d.Thumbnail {
@@ -198,7 +199,7 @@ func (d *Local) Get(ctx context.Context, path string) (model.Obj, error) {
198199
path = filepath.Join(d.GetRootPath(), path)
199200
f, err := os.Stat(path)
200201
if err != nil {
201-
if strings.Contains(err.Error(), "cannot find the file") {
202+
if os.IsNotExist(err) {
202203
return nil, errs.ObjectNotFound
203204
}
204205
return nil, err
@@ -375,7 +376,7 @@ func (d *Local) Remove(ctx context.Context, obj model.Obj) error {
375376
}
376377
} else {
377378
if !utils.Exists(d.RecycleBinPath) {
378-
err = os.MkdirAll(d.RecycleBinPath, 0755)
379+
err = os.MkdirAll(d.RecycleBinPath, 0o755)
379380
if err != nil {
380381
return err
381382
}

0 commit comments

Comments
 (0)