Module: deluge
Branch: master
Commit: 298b85c368d1a409562bc01c33d841303c273ae7

Author: John Garland <[email protected]>
Date:   Wed Mar 23 23:38:41 2011 +1100

Improve autoadd filename matching (fixes #1614)

---

 deluge/core/autoadd.py |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/deluge/core/autoadd.py b/deluge/core/autoadd.py
index 911b560..acab220 100644
--- a/deluge/core/autoadd.py
+++ b/deluge/core/autoadd.py
@@ -76,12 +76,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:

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to