fix: 解决本地备份账号无法切换到根目录的问题 (#3782)

pull/3785/head
ssongliu 2024-02-01 22:36:01 +08:00 committed by GitHub
parent e5d3c1bb86
commit 2f7bb6d784
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -334,7 +334,7 @@ func (u *BackupService) Update(req dto.BackupOperate) error {
if backup.Type == "LOCAL" { if backup.Type == "LOCAL" {
if dir, ok := varMap["dir"]; ok { if dir, ok := varMap["dir"]; ok {
if dirStr, isStr := dir.(string); isStr { if dirStr, isStr := dir.(string); isStr {
if strings.HasSuffix(dirStr, "/") { if strings.HasSuffix(dirStr, "/") && dirStr != "/" {
dirStr = dirStr[:strings.LastIndex(dirStr, "/")] dirStr = dirStr[:strings.LastIndex(dirStr, "/")]
} }
if err := copyDir(oldDir, dirStr); err != nil { if err := copyDir(oldDir, dirStr); err != nil {