changeset 1083:0d837624e795 bug_531

If the file is large, acknowledge that it might be too large rather than binary (could be a big text file)
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 22 Nov 2012 18:10:33 +0000
parents 997f6d7738f7
children 3b7e11eaf1ca d65e60e20a50
files app/views/repositories/entry.html.erb config/locales/en.yml
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/app/views/repositories/entry.html.erb	Thu Nov 22 18:04:17 2012 +0000
+++ b/app/views/repositories/entry.html.erb	Thu Nov 22 18:10:33 2012 +0000
@@ -9,7 +9,11 @@
 <p><%= render :partial => 'link_to_functions' %></p>
 
 <% if @display_raw %>
-   <em><%= l(:text_binary_data) %></em>
+   <% if @content.size && @content.size > Setting.file_max_size_displayed.to_i.kilobyte %>
+     <em><%= l(:text_data_too_large) %></em>
+   <% else %>
+     <em><%= l(:text_binary_data) %></em>
+   <% end %>
 <% else %>
   <%= render :partial => 'common/file', :locals => {:filename => @path, :content => @content} %>
 <% end %>
--- a/config/locales/en.yml	Thu Nov 22 18:04:17 2012 +0000
+++ b/config/locales/en.yml	Thu Nov 22 18:10:33 2012 +0000
@@ -1033,6 +1033,7 @@
   text_has_welcome_page_info: <b>Welcome page</b><p>You can replace the standard {{overview_link}} page for this project with your own welcome page.<br>This page will be editable using the project Wiki.
   text_has_welcome_page_wiki_disabled: <b>Note:</b> You must enable the Wiki module in the {{modules_link}} tab before you can create or edit this page.
   text_binary_data: Binary data
+  text_data_too_large: Binary data, or file too large to display
 
   default_role_manager: Manager
   default_role_developer: Developer