fix(aria2): directory missing (close #1856 pr #2504)

pull/2520/head
Simon 2022-11-28 01:05:28 -05:00 committed by GitHub
parent ddcba93eea
commit 61a06992c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path"
"path/filepath"
"strconv"
"sync"
"sync/atomic"
@ -171,7 +172,12 @@ func (m *Monitor) Complete() error {
ReadCloser: f,
Mimetype: mimetype,
}
return op.Put(tsk.Ctx, storage, dstDirActualPath, stream, tsk.SetProgress)
relDir, err := filepath.Rel(m.tempDir, filepath.Dir(file.Path))
if err != nil {
log.Errorf("find relation directory error: %v", err)
}
newDistDir := filepath.Join(dstDirActualPath, relDir)
return op.Put(tsk.Ctx, storage, newDistDir, stream, tsk.SetProgress)
},
}))
}