[Core] Allow renaming torrent to empty string to remove the folder

This commit is contained in:
bendikro 2016-02-22 00:54:35 +01:00 committed by Calum Lind
parent 887afa9389
commit af6f2b2107

View file

@ -1290,11 +1290,10 @@ class Torrent(object):
twisted.internet.defer.Deferred: A deferred which fires when the rename is complete
"""
log.debug("Attempting to rename folder: %s to %s", folder, new_folder)
if len(new_folder) < 1:
log.error("Attempting to rename a folder with an invalid folder name: %s", new_folder)
return
new_folder = sanitize_filepath(new_folder, folder=True)
# Empty string means remove the dir and move its content to the parent
if len(new_folder) > 0:
new_folder = sanitize_filepath(new_folder, folder=True)
def on_file_rename_complete(dummy_result, wait_dict, index):
"""File rename complete"""