Set mime type when previewing tabular data that has > 50 columns, but < 1000000 bytes. Fixes the issue of losing newlines and actual spacing (i.e. do not treat as html).

This commit is contained in:
Daniel Blankenberg
2016-01-13 16:28:59 -05:00
parent becffe93a3
commit 0bcfa74ea1
+1
View File
@@ -81,6 +81,7 @@ class TabularData( data.Text ):
# For now, default to the old behavior, ugly as it is. Remove this after adding 'matrix'.
max_peek_size = 1000000 # 1 MB
if os.stat( dataset.file_name ).st_size < max_peek_size:
self._clean_and_set_mime_type( trans, dataset.get_mime() )
return open( dataset.file_name )
else:
trans.response.set_content_type( "text/html" )