From b4b3b9c6b7a61dbe54ad3fab8628103fa81905e7 Mon Sep 17 00:00:00 2001
From: Calum Lind <calumlind+deluge@gmail.com>
Date: Thu, 27 Jan 2011 18:22:09 +0000
Subject: [PATCH 2/2] Fix #1498: On folder rename ensures trailing slash and replaces any duplicates
---
deluge/core/torrent.py | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 7651b6e..5a4d723 100644
a
|
b
|
|
37 | 37 | import os |
38 | 38 | import time |
39 | 39 | import logging |
| 40 | import re |
40 | 41 | from urllib import unquote |
41 | 42 | from urlparse import urlparse |
42 | 43 | |
… |
… |
def rename_folder(self, folder, new_folder):
|
903 | 904 | log.error("Attempting to rename a folder with an invalid folder name: %s", new_folder) |
904 | 905 | return |
905 | 906 | |
906 | | if new_folder[-1:] != "/": |
907 | | new_folder += "/" |
| 907 | # Ensures trailing slash and replaces any duplicates |
| 908 | p = re.compile('/{2,}') |
| 909 | new_folder=p.sub('/',new_folder + "/") |
908 | 910 | |
909 | 911 | wait_on_folder = (folder, new_folder, []) |
910 | 912 | for f in self.get_files(): |