# HG changeset patch # User dellsystem # Date 1350791021 14400 # Node ID 76abe6d681ea68acb332408be1a1a0d4263141a7 # Parent df160069b7697ca8e7d6845c6aaf25f92f5bc9c9 Add whitelist for other text-like mimetypes Just XML for now. diff --git a/apps/bundle/tasks.py b/apps/bundle/tasks.py --- a/apps/bundle/tasks.py +++ b/apps/bundle/tasks.py @@ -13,6 +13,9 @@ mimetypes.add_type('application/x-gzip', '.tgz') mimetypes.add_type('application/x-bzip2', '.tz2') archive_extensions = ('.zip', '.tgz', '.tar', '.tz2') +text_mimetypes = ( + 'application/xml', +) def process_files_in_dir(bundle, dir_name, parent_dir): @@ -39,7 +42,7 @@ # Only highlight the file contents if it's plain text mime_type = magic.from_file(file_path, mime=True) - if mime_type.startswith('text/'): + if mime_type.startswith('text/') or mime_type in text_mimetypes: with open(file_path, 'rt') as file: # Store the contents of the file in the code field bundle_file.save_file_contents(file)