[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GMG-Devel] [PATCH] mediagoblin/media_types/__init__.py: fix off by one
From: |
Alon Levy |
Subject: |
[GMG-Devel] [PATCH] mediagoblin/media_types/__init__.py: fix off by one error |
Date: |
Tue, 25 Feb 2014 15:31:17 +0200 |
get_media_type_and_manager was not correctly getting the extention for files
starting with a ".". string.find returns -1 on error, not 0 - 0 is a valid
index.
---
mediagoblin/media_types/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mediagoblin/media_types/__init__.py
b/mediagoblin/media_types/__init__.py
index 2e39231..6b02900 100644
--- a/mediagoblin/media_types/__init__.py
+++ b/mediagoblin/media_types/__init__.py
@@ -85,7 +85,7 @@ def get_media_type_and_manager(filename):
specifically. This is used as a speedup, the sniffing functionality
then falls back on more in-depth bitsniffing of the source file.
'''
- if filename.find('.') > 0:
+ if filename.find('.') > -1:
# Get the file extension
ext = os.path.splitext(filename)[1].lower()
--
1.8.5.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GMG-Devel] [PATCH] mediagoblin/media_types/__init__.py: fix off by one error,
Alon Levy <=