Skip to content

Commit 9ed2cd9

Browse files
authored
Fix issue with downloads moving after restart (#8699)
2 parents 1ede3a3 + 03ce0f5 commit 9ed2cd9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/tribler/core/libtorrent/download_manager/download_config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,12 @@ def set_completed_dir(self, path: Path | str) -> None:
192192
"""
193193
self.config["download_defaults"]["completed_dir"] = str(path)
194194

195-
def get_completed_dir(self) -> str | None:
195+
def get_completed_dir(self) -> Path | None:
196196
"""
197197
Gets the directory where to move this Download upon completed.
198198
"""
199-
return self.config["download_defaults"].get("completed_dir")
199+
completed_dir = self.config["download_defaults"].get("completed_dir")
200+
return Path(completed_dir) if completed_dir else None
200201

201202
def set_hops(self, hops: int) -> None:
202203
"""

src/tribler/core/libtorrent/restapi/downloads_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ async def get_downloads(self, request: Request) -> RESTResponse:
329329
"upload_limit": download.get_upload_limit(),
330330
"download_limit": download.get_download_limit(),
331331
"destination": str(download.config.get_dest_dir()),
332-
"completed_dir": download.config.get_completed_dir(),
332+
"completed_dir": str(download.config.get_completed_dir() or ""),
333333
"total_pieces": tdef.torrent_info.num_pieces() if tdef.torrent_info else 0,
334334
"error": repr(state.get_error()) if state.get_error() else "",
335335
"time_added": download.config.get_time_added(),

0 commit comments

Comments
 (0)