From b626f628eb9966b7017dcc4a9d715a99c01b1f4f Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Fri, 14 Sep 2007 10:14:04 +0200 Subject: [PATCH] Fix mime.get_primary_extension(). --- sugar/objects/mime.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sugar/objects/mime.py b/sugar/objects/mime.py index baa014fe..08b26b1a 100644 --- a/sugar/objects/mime.py +++ b/sugar/objects/mime.py @@ -40,10 +40,13 @@ def get_primary_extension(mime_type): f = open('/etc/mime.types') while True: line = f.readline() + if not line: + break cols = line.replace('\t', ' ').split(' ') if mime_type == cols[0]: for col in cols[1:]: if col: + col = col.replace('\n', '') _extensions_cache[mime_type] = col return col