From ad4e276a39aa6cb0a8187c0419b081d9525cfd35 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 30 Nov 2008 00:53:46 +0000 Subject: [PATCH] Fix renaming folders when there is no trailing slash --- deluge/core/torrent.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index dce0e7c0b..832ef9806 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -817,6 +817,13 @@ class Torrent: """Renames a folder within a torrent. This basically does a file rename on all of the folders children.""" 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(): if f["path"].startswith(folder): # Keep a list of filerenames we're waiting on