##// END OF EJS Templates
file-source: ensure over size limit files never do any content fetching when viewing the files....
dan -
r3897:66d45858 default
parent child Browse files
Show More
@@ -668,7 +668,10 b' class RepoFilesView(RepoAppView):'
668
668
669 c.file_source_page = 'true'
669 c.file_source_page = 'true'
670 c.file_last_commit = c.file.last_commit
670 c.file_last_commit = c.file.last_commit
671 if c.file.size < c.visual.cut_off_limit_diff:
671
672 c.file_size_too_big = c.file.size > c.visual.cut_off_limit_file
673
674 if not c.file_size_too_big:
672 if c.annotate: # annotation has precedence over renderer
675 if c.annotate: # annotation has precedence over renderer
673 c.annotated_lines = filenode_as_annotated_lines_tokens(
676 c.annotated_lines = filenode_as_annotated_lines_tokens(
674 c.file
677 c.file
@@ -60,14 +60,28 b''
60 <div class="file-stats">
60 <div class="file-stats">
61
61
62 <div class="stats-info">
62 <div class="stats-info">
63 <span class="stats-first-item">${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])}</span>
63 <span class="stats-first-item">
64 % if c.file_size_too_big:
65 0 ${(_('lines'))}
66 % else:
67 ${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])}
68 % endif
69 </span>
64
70
65 <span> | ${h.format_byte_size_binary(c.file.size)}</span>
71 <span> | ${h.format_byte_size_binary(c.file.size)}</span>
66 % if c.lf_node:
72 % if c.lf_node:
67 <span title="${_('This file is a pointer to large binary file')}"> | ${_('LargeFile')} ${h.format_byte_size_binary(c.lf_node.size)} </span>
73 <span title="${_('This file is a pointer to large binary file')}"> | ${_('LargeFile')} ${h.format_byte_size_binary(c.lf_node.size)} </span>
68 % endif
74 % endif
69 <span> | ${c.file.mimetype} </span>
75 <span>
70 <span> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
76 | ${c.file.mimetype}
77 </span>
78
79 % if not c.file_size_too_big:
80 <span> |
81 ${h.get_lexer_for_filenode(c.file).__class__.__name__}
82 </span>
83 % endif
84
71 </div>
85 </div>
72 </div>
86 </div>
73 </div>
87 </div>
@@ -94,18 +108,20 b''
94 </div>
108 </div>
95
109
96 <div class="code-body clear-fix ">
110 <div class="code-body clear-fix ">
97
98 %if c.file.is_binary:
111 %if c.file.is_binary:
99 <% rendered_binary = h.render_binary(c.repo_name, c.file)%>
112 <% rendered_binary = h.render_binary(c.repo_name, c.file)%>
100 % if rendered_binary:
113 % if rendered_binary:
101 ${rendered_binary}
114 ${rendered_binary}
102 % else:
115 % else:
103 <div>
116 <div>
104 ${_('Binary file (%s)') % c.file.mimetype}
117 ${_('Binary file ({})').format(c.file.mimetype)}
105 </div>
118 </div>
106 % endif
119 % endif
107 %else:
120 %else:
108 % if c.file.size < c.visual.cut_off_limit_file:
121 % if c.file_size_too_big:
122 ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'),
123 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
124 % else:
109 %if c.renderer and not c.annotate:
125 %if c.renderer and not c.annotate:
110 ## pick relative url based on renderer
126 ## pick relative url based on renderer
111 <%
127 <%
@@ -129,9 +145,6 b''
129 %endif
145 %endif
130 </table>
146 </table>
131 %endif
147 %endif
132 %else:
133 ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'),
134 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
135 %endif
148 % endif
136 %endif
149 %endif
137 </div>
150 </div>
General Comments 0
You need to be logged in to leave comments. Login now