mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-25 12:05:30 +00:00
Fix: os.join created root path in Remove_Empty_Folder if variable 'folder' had a leading slash
This commit is contained in:
parent
98ca371b15
commit
1e0005f572
1 changed files with 10 additions and 7 deletions
|
@ -42,6 +42,7 @@ import time
|
||||||
import shutil
|
import shutil
|
||||||
import operator
|
import operator
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
|
|
||||||
from twisted.internet import reactor
|
from twisted.internet import reactor
|
||||||
from twisted.internet.task import LoopingCall
|
from twisted.internet.task import LoopingCall
|
||||||
|
@ -757,7 +758,9 @@ class TorrentManager(component.Component):
|
||||||
raise InvalidTorrentError("torrent_id is not in session")
|
raise InvalidTorrentError("torrent_id is not in session")
|
||||||
|
|
||||||
info = self.torrents[torrent_id].get_status(['save_path'])
|
info = self.torrents[torrent_id].get_status(['save_path'])
|
||||||
folder_full_path = os.path.join(info['save_path'], folder)
|
# Regex removes leading slashes that causes join function to ignore save_path
|
||||||
|
folder_full_path = os.path.join(info['save_path'], re.sub("^/*", "", folder))
|
||||||
|
folder_full_path = os.path.normpath(folder_full_path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not os.listdir(folder_full_path):
|
if not os.listdir(folder_full_path):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue