Fix renaming folders when there is no trailing slash

This commit is contained in:
Andrew Resch 2008-11-30 00:53:46 +00:00
parent 4d65f237b1
commit ad4e276a39
1 changed files with 7 additions and 0 deletions

View File

@ -817,6 +817,13 @@ class Torrent:
"""Renames a folder within a torrent. This basically does a file rename """Renames a folder within a torrent. This basically does a file rename
on all of the folders children.""" on all of the folders children."""
log.debug("attempting to rename folder: %s to %s", folder, new_folder) 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
if new_folder[-1:] != "/":
new_folder += "/"
for f in self.get_files(): for f in self.get_files():
if f["path"].startswith(folder): if f["path"].startswith(folder):
# Keep a list of filerenames we're waiting on # Keep a list of filerenames we're waiting on