diff --git a/internal/bootstrap/config.go b/internal/bootstrap/config.go index ff36509c..27174c23 100644 --- a/internal/bootstrap/config.go +++ b/internal/bootstrap/config.go @@ -102,7 +102,13 @@ func initURL() { } func CleanTempDir() { - if err := os.RemoveAll(conf.Conf.TempDir); err != nil { - log.Errorln("failed delete temp file: ", err) + files, err := os.ReadDir(conf.Conf.TempDir) + if err != nil { + log.Errorln("failed list temp file: ", err) + } + for _, file := range files { + if err := os.RemoveAll(filepath.Join(conf.Conf.TempDir, file.Name())); err != nil { + log.Errorln("failed delete temp file: ", err) + } } } diff --git a/internal/op/fs.go b/internal/op/fs.go index e0153952..e49c941a 100644 --- a/internal/op/fs.go +++ b/internal/op/fs.go @@ -267,6 +267,12 @@ func Link(ctx context.Context, storage driver.Driver, path string, args model.Li } return link, nil } + + if storage.Config().OnlyLocal { + link, err := fn() + return link, file, err + } + link, err, _ := linkG.Do(key, fn) return link, file, err }