mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-28 21:47:56 +08:00
fix
This commit is contained in:
@@ -32,8 +32,8 @@ func (w *WebdavStorage) Move(local, remote string) error {
|
|||||||
baseLocal := filepath.Base(local)
|
baseLocal := filepath.Base(local)
|
||||||
remoteBase := filepath.Join(w.dir,remote, baseLocal)
|
remoteBase := filepath.Join(w.dir,remote, baseLocal)
|
||||||
|
|
||||||
log.Infof("remove all content in %s", remoteBase)
|
//log.Infof("remove all content in %s", remoteBase)
|
||||||
w.fs.RemoveAll(remoteBase)
|
//w.fs.RemoveAll(remoteBase)
|
||||||
err := filepath.Walk(local, func(path string, info fs.FileInfo, err error) error {
|
err := filepath.Walk(local, func(path string, info fs.FileInfo, err error) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "read file %v", path)
|
return errors.Wrapf(err, "read file %v", path)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ func (s *Server) moveCompletedTask(id int) (err error) {
|
|||||||
torrent := s.tasks[id]
|
torrent := s.tasks[id]
|
||||||
r := s.db.GetHistory(id)
|
r := s.db.GetHistory(id)
|
||||||
if r.Status == history.StatusUploading {
|
if r.Status == history.StatusUploading {
|
||||||
log.Infof("task %d is laready uploading, skip", id)
|
log.Infof("task %d is already uploading, skip", id)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
s.db.SetHistoryStatus(r.ID, history.StatusUploading)
|
s.db.SetHistoryStatus(r.ID, history.StatusUploading)
|
||||||
@@ -60,6 +60,8 @@ func (s *Server) moveCompletedTask(id int) (err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
s.db.SetHistoryStatus(r.ID, history.StatusFail)
|
s.db.SetHistoryStatus(r.ID, history.StatusFail)
|
||||||
} else {
|
} else {
|
||||||
|
torrent.Remove()
|
||||||
|
delete(s.tasks, r.ID)
|
||||||
s.db.SetHistoryStatus(r.ID, history.StatusSuccess)
|
s.db.SetHistoryStatus(r.ID, history.StatusSuccess)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
@@ -93,9 +95,6 @@ func (s *Server) moveCompletedTask(id int) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.Infof("move downloaded files to target dir success, file: %v, target dir: %v", torrent.Name(), r.TargetDir)
|
log.Infof("move downloaded files to target dir success, file: %v, target dir: %v", torrent.Name(), r.TargetDir)
|
||||||
torrent.Remove()
|
|
||||||
delete(s.tasks, r.ID)
|
|
||||||
s.db.SetHistoryStatus(r.ID, history.StatusSuccess)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user