Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
adding in to the whitelist (bug 651800)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy McKay committed Apr 21, 2011
1 parent 0cdc333 commit 36996d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions apps/files/helpers.py
Expand Up @@ -73,10 +73,13 @@ def is_binary(self, mimetype, filename):
major, minor = mimetype.split('/')
if major == 'text' and minor in ['plain', 'html', 'css']:
return False
elif major == 'application' and minor in ['json']:
return False
elif minor in ['xml', 'rdf+xml', 'javascript', 'x-javascript',
'xml-dtd', 'vnd.mozilla.xul+xml']:
'xml-dtd', 'vnd.mozilla.xul+xml']:
return False
elif os.path.splitext(filename)[1] in ['.dtd', '.xul', '.properties']:
elif os.path.splitext(filename)[1] in ['.dtd', '.xul', '.properties',
'.src', '.mf', '.sf', '.json']:
return False
return True

Expand Down
2 changes: 1 addition & 1 deletion apps/files/tests/test_helpers.py
Expand Up @@ -64,7 +64,7 @@ def test_isbinary(self):
binary = self.viewer.is_binary
for f in ['foo.rdf', 'foo.xml', 'foo.js', 'foo.py'
'foo.html', 'foo.txt', 'foo.dtd', 'foo.xul',
'foo.properties']:
'foo.properties', 'foo.json']:
m, encoding = mimetypes.guess_type(f)
assert not binary(m, f), '%s should not be binary' % f

Expand Down

0 comments on commit 36996d7

Please sign in to comment.