##// END OF EJS Templates
files: make the copy of the file use safe path. This fixes problem...
marcink -
r2089:ba0b1c99 default
parent child Browse files
Show More
@@ -1,105 +1,105 b''
1 <%namespace name="sourceblock" file="/codeblocks/source.mako"/>
1 <%namespace name="sourceblock" file="/codeblocks/source.mako"/>
2
2
3 <div id="codeblock" class="codeblock">
3 <div id="codeblock" class="codeblock">
4 <div class="codeblock-header">
4 <div class="codeblock-header">
5 <div class="stats">
5 <div class="stats">
6 <span>
6 <span>
7 <strong>
7 <strong>
8 <i class="icon-file-text"></i>
8 <i class="icon-file-text"></i>
9 ${c.file}
9 ${c.file}
10 </strong>
10 </strong>
11 </span>
11 </span>
12 % if c.lf_node:
12 % if c.lf_node:
13 <span title="${_('This file is a pointer to large binary file')}"> | ${_('LargeFile')} ${h.format_byte_size_binary(c.lf_node.size)} </span>
13 <span title="${_('This file is a pointer to large binary file')}"> | ${_('LargeFile')} ${h.format_byte_size_binary(c.lf_node.size)} </span>
14 % endif
14 % endif
15 <span> | ${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])}</span>
15 <span> | ${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])}</span>
16 <span> | ${h.format_byte_size_binary(c.file.size)}</span>
16 <span> | ${h.format_byte_size_binary(c.file.size)}</span>
17 <span> | ${c.file.mimetype} </span>
17 <span> | ${c.file.mimetype} </span>
18 <span> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
18 <span> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
19 <span class="item last"> | <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.file.path}" title="${_('Copy the full path')}"></i></span>
19 <span class="item last"> | <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.f_path}" title="${_('Copy the full path')}"></i></span>
20 </div>
20 </div>
21 <div class="buttons">
21 <div class="buttons">
22 <a id="file_history_overview" href="#">
22 <a id="file_history_overview" href="#">
23 ${_('History')}
23 ${_('History')}
24 </a>
24 </a>
25 <a id="file_history_overview_full" style="display: none" href="${h.route_path('repo_changelog_file',repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">
25 <a id="file_history_overview_full" style="display: none" href="${h.route_path('repo_changelog_file',repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">
26 ${_('Show Full History')}
26 ${_('Show Full History')}
27 </a> |
27 </a> |
28 %if c.annotate:
28 %if c.annotate:
29 ${h.link_to(_('Source'), h.route_path('repo_files', repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
29 ${h.link_to(_('Source'), h.route_path('repo_files', repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
30 %else:
30 %else:
31 ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
31 ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
32 %endif
32 %endif
33 | ${h.link_to(_('Raw'), h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
33 | ${h.link_to(_('Raw'), h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
34 |
34 |
35 % if c.lf_node:
35 % if c.lf_node:
36 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _query=dict(lf=1))}">
36 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _query=dict(lf=1))}">
37 ${_('Download largefile')}
37 ${_('Download largefile')}
38 </a>
38 </a>
39 % else:
39 % else:
40 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
40 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
41 ${_('Download')}
41 ${_('Download')}
42 </a>
42 </a>
43 % endif
43 % endif
44
44
45 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
45 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
46 |
46 |
47 %if c.on_branch_head and c.branch_or_raw_id and not c.file.is_binary:
47 %if c.on_branch_head and c.branch_or_raw_id and not c.file.is_binary:
48 <a href="${h.route_path('repo_files_edit_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">
48 <a href="${h.route_path('repo_files_edit_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">
49 ${_('Edit on Branch:{}').format(c.branch_name)}
49 ${_('Edit on Branch:{}').format(c.branch_name)}
50 </a>
50 </a>
51 | <a class="btn-danger btn-link" href="${h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">${_('Delete')}
51 | <a class="btn-danger btn-link" href="${h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">${_('Delete')}
52 </a>
52 </a>
53 %elif c.on_branch_head and c.branch_or_raw_id and c.file.is_binary:
53 %elif c.on_branch_head and c.branch_or_raw_id and c.file.is_binary:
54 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing binary files not allowed'))}
54 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing binary files not allowed'))}
55 | ${h.link_to(_('Delete'), h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit'),class_="btn-danger btn-link")}
55 | ${h.link_to(_('Delete'), h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit'),class_="btn-danger btn-link")}
56 %else:
56 %else:
57 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing files allowed only when on branch head commit'))}
57 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing files allowed only when on branch head commit'))}
58 | ${h.link_to(_('Delete'), '#', class_="btn btn-danger btn-link disabled tooltip", title=_('Deleting files allowed only when on branch head commit'))}
58 | ${h.link_to(_('Delete'), '#', class_="btn btn-danger btn-link disabled tooltip", title=_('Deleting files allowed only when on branch head commit'))}
59 %endif
59 %endif
60 %endif
60 %endif
61 </div>
61 </div>
62 </div>
62 </div>
63 <div id="file_history_container"></div>
63 <div id="file_history_container"></div>
64 <div class="code-body">
64 <div class="code-body">
65 %if c.file.is_binary:
65 %if c.file.is_binary:
66 <% rendered_binary = h.render_binary(c.repo_name, c.file)%>
66 <% rendered_binary = h.render_binary(c.repo_name, c.file)%>
67 % if rendered_binary:
67 % if rendered_binary:
68 ${rendered_binary}
68 ${rendered_binary}
69 % else:
69 % else:
70 <div>
70 <div>
71 ${_('Binary file (%s)') % c.file.mimetype}
71 ${_('Binary file (%s)') % c.file.mimetype}
72 </div>
72 </div>
73 % endif
73 % endif
74 %else:
74 %else:
75 % if c.file.size < c.visual.cut_off_limit_file:
75 % if c.file.size < c.visual.cut_off_limit_file:
76 %if c.renderer and not c.annotate:
76 %if c.renderer and not c.annotate:
77 ## pick relative url based on renderer
77 ## pick relative url based on renderer
78 <%
78 <%
79 relative_urls = {
79 relative_urls = {
80 'raw': h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path),
80 'raw': h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path),
81 'standard': h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path),
81 'standard': h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path),
82 }
82 }
83 %>
83 %>
84 ${h.render(c.file.content, renderer=c.renderer, relative_urls=relative_urls)}
84 ${h.render(c.file.content, renderer=c.renderer, relative_urls=relative_urls)}
85 %else:
85 %else:
86 <table class="cb codehilite">
86 <table class="cb codehilite">
87 %if c.annotate:
87 %if c.annotate:
88 <% color_hasher = h.color_hasher() %>
88 <% color_hasher = h.color_hasher() %>
89 %for annotation, lines in c.annotated_lines:
89 %for annotation, lines in c.annotated_lines:
90 ${sourceblock.render_annotation_lines(annotation, lines, color_hasher)}
90 ${sourceblock.render_annotation_lines(annotation, lines, color_hasher)}
91 %endfor
91 %endfor
92 %else:
92 %else:
93 %for line_num, tokens in enumerate(c.lines, 1):
93 %for line_num, tokens in enumerate(c.lines, 1):
94 ${sourceblock.render_line(line_num, tokens)}
94 ${sourceblock.render_line(line_num, tokens)}
95 %endfor
95 %endfor
96 %endif
96 %endif
97 </table>
97 </table>
98 %endif
98 %endif
99 %else:
99 %else:
100 ${_('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'),
100 ${_('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'),
101 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
101 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
102 %endif
102 %endif
103 %endif
103 %endif
104 </div>
104 </div>
105 </div> No newline at end of file
105 </div>
General Comments 0
You need to be logged in to leave comments. Login now