summaryrefslogtreecommitdiff
path: root/app/views/projects/blob
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/projects/blob')
-rw-r--r--app/views/projects/blob/_viewer.html.haml8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/views/projects/blob/_viewer.html.haml b/app/views/projects/blob/_viewer.html.haml
index 7660a5fed75..cc85e5de40f 100644
--- a/app/views/projects/blob/_viewer.html.haml
+++ b/app/views/projects/blob/_viewer.html.haml
@@ -11,4 +11,10 @@
- else
- viewer.prepare!
- = render 'projects/tree/tree_content'
+ -# In the rare case where the first kilobyte of the file looks like text,
+ -# but the file turns out to actually be binary after loading all data,
+ -# we fall back on the binary Download viewer.
+ - viewer = BlobViewer::Download.new(viewer.blob) if viewer.binary_detected_after_load?
+
+ = render viewer.partial_path, viewer: viewer
+