Fix mime.get_primary_extension().
This commit is contained in:
parent
fe39b82a93
commit
b626f628eb
@ -40,10 +40,13 @@ def get_primary_extension(mime_type):
|
|||||||
f = open('/etc/mime.types')
|
f = open('/etc/mime.types')
|
||||||
while True:
|
while True:
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
cols = line.replace('\t', ' ').split(' ')
|
cols = line.replace('\t', ' ').split(' ')
|
||||||
if mime_type == cols[0]:
|
if mime_type == cols[0]:
|
||||||
for col in cols[1:]:
|
for col in cols[1:]:
|
||||||
if col:
|
if col:
|
||||||
|
col = col.replace('\n', '')
|
||||||
_extensions_cache[mime_type] = col
|
_extensions_cache[mime_type] = col
|
||||||
return col
|
return col
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user