fix(webdav): replace filepath with path for directory creation

This commit is contained in:
krau
2025-02-12 10:29:12 +08:00
parent a25a58f8a2
commit a32bf43cdc
3 changed files with 47 additions and 17 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"os"
"path"
"path/filepath"
"strings"
"time"
@@ -33,8 +32,8 @@ func (w *Webdav) Init() {
func (w *Webdav) Save(ctx context.Context, filePath, storagePath string) error {
storagePath = path.Join(basePath, storagePath)
if err := Client.MkdirAll(filepath.Dir(storagePath), os.ModePerm); err != nil {
logger.L.Errorf("Failed to create directory %s: %v", filepath.Dir(storagePath), err)
if err := Client.MkdirAll(path.Dir(storagePath), os.ModePerm); err != nil {
logger.L.Errorf("Failed to create directory %s: %v", path.Dir(storagePath), err)
return ErrFailedToCreateDirectory
}
file, err := os.Open(filePath)