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

This commit is contained in:
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

View File

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