Fix: os.join created root path in Remove_Empty_Folder if variable 'folder' had a leading slash
This commit is contained in:
parent
4490cd371a
commit
53b4a06fd1
|
@ -41,6 +41,7 @@ import os
|
|||
import time
|
||||
import shutil
|
||||
import operator
|
||||
import re
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.task import LoopingCall
|
||||
|
@ -741,7 +742,9 @@ class TorrentManager(component.Component):
|
|||
raise InvalidTorrentError("torrent_id is not in session")
|
||||
|
||||
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:
|
||||
if not os.listdir(folder_full_path):
|
||||
|
|
Loading…
Reference in New Issue