[kupfer] textfiles: Check file existance in mime-type check



commit fd6c34e9f71dd9fecd37f78ad371edc23f2b8d14
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Mon Mar 21 15:22:39 2011 +0100

    textfiles: Check file existance in mime-type check

 kupfer/plugin/textfiles.py |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/plugin/textfiles.py b/kupfer/plugin/textfiles.py
index f2515c5..001b2d5 100644
--- a/kupfer/plugin/textfiles.py
+++ b/kupfer/plugin/textfiles.py
@@ -39,6 +39,8 @@ def is_content_type(fileleaf, ctype):
 		return ret
 	content_attr = gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE
 	gfile = gio.File(fileleaf.object)
+	if not gfile.query_exists(None):
+		return
 	info = gfile.query_info(content_attr)
 	content_type = info.get_attribute_string(content_attr)
 	return predicate(content_type, ctype)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]