From 00ad550a52560a68436bb5b51a2357dbf415afc4 Mon Sep 17 00:00:00 2001 From: John Garland Date: Wed, 23 Mar 2011 23:38:41 +1100 Subject: [PATCH] Improve autoadd filename matching (fixes #1614) --- ChangeLog | 1 + deluge/core/autoadd.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76707cce7..d532e11b3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ * Fix a bug that can occur when upgrading 1.1 config files * #1517: Fix isohunt urls not loading * Handle redirection when adding a torrent by url + * #1614: Fix autoadd matching a directory called "torrent" ==== GtkUI ==== * #1514: Added Indicator Applet diff --git a/deluge/core/autoadd.py b/deluge/core/autoadd.py index 6d3d7a8bc..8d1219c9f 100644 --- a/deluge/core/autoadd.py +++ b/deluge/core/autoadd.py @@ -74,12 +74,12 @@ class AutoAdd(component.Component): return for filename in os.listdir(self.config["autoadd_location"]): - if filename.split(".")[-1] == "torrent": - try: - filepath = os.path.join(self.config["autoadd_location"], filename) - except UnicodeDecodeError, e: - log.error("Unable to auto add torrent due to inproper filename encoding: %s", e) - continue + try: + filepath = os.path.join(self.config["autoadd_location"], filename) + except UnicodeDecodeError, e: + log.error("Unable to auto add torrent due to improper filename encoding: %s", e) + continue + if os.path.isfile(filepath) and filename.endswith(".torrent"): try: filedump = self.load_torrent(filepath) except (RuntimeError, Exception), e: