##// END OF EJS Templates
security: fix self xss on repo downloads picker for svn case.
ergo -
r2234:8f4440a2 stable
parent child Browse files
Show More
@@ -1,136 +1,137 b''
1 1 <%inherit file="/summary/summary_base.mako"/>
2 2
3 3 <%namespace name="components" file="/summary/components.mako"/>
4 4
5 5
6 6 <%def name="menu_bar_subnav()">
7 7 ${self.repo_menu(active='summary')}
8 8 </%def>
9 9
10 10 <%def name="main()">
11 11
12 12 <div class="title">
13 13 ${self.repo_page_title(c.rhodecode_db_repo)}
14 14 <ul class="links icon-only-links block-right">
15 15 <li>
16 16 %if c.rhodecode_user.username != h.DEFAULT_USER:
17 17 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name, _query=dict(auth_token=c.rhodecode_user.feed_token))}" title="${_('RSS Feed')}"><i class="icon-rss-sign"></i></a>
18 18 %else:
19 19 <a href="${h.route_path('atom_feed_home', repo_name=c.rhodecode_db_repo.repo_name)}" title="${_('RSS Feed')}"><i class="icon-rss-sign"></i></a>
20 20 %endif
21 21 </li>
22 22 </ul>
23 23 </div>
24 24
25 25 <div id="repo-summary" class="summary">
26 26 ${components.summary_detail(breadcrumbs_links=self.breadcrumbs_links(), show_downloads=True)}
27 27 ${components.summary_stats(gravatar_function=self.gravatar_with_user)}
28 28 </div><!--end repo-summary-->
29 29
30 30
31 31 <div class="box" >
32 32 %if not c.repo_commits:
33 33 <div class="title">
34 34 <h3>${_('Quick start')}</h3>
35 35 </div>
36 36 %endif
37 37 <div class="table">
38 38 <div id="shortlog_data">
39 39 <%include file='summary_commits.mako'/>
40 40 </div>
41 41 </div>
42 42 </div>
43 43
44 44 %if c.readme_data:
45 45 <div id="readme" class="anchor">
46 46 <div class="box" >
47 47 <div class="title" title="${h.tooltip(_('Readme file from commit %s:%s') % (c.rhodecode_db_repo.landing_rev[0], c.rhodecode_db_repo.landing_rev[1]))}">
48 48 <h3 class="breadcrumbs">
49 49 <a href="${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.landing_rev[1],f_path=c.readme_file)}">${c.readme_file}</a>
50 50 </h3>
51 51 </div>
52 52 <div class="readme codeblock">
53 53 <div class="readme_box">
54 54 ${c.readme_data|n}
55 55 </div>
56 56 </div>
57 57 </div>
58 58 </div>
59 59 %endif
60 60
61 61 <script type="text/javascript">
62 62 $(document).ready(function(){
63 63 $('#clone_by_name').on('click',function(e){
64 64 // show url by name and hide name button
65 65 $('#clone_url').show();
66 66 $('#clone_by_name').hide();
67 67
68 68 // hide url by id and show name button
69 69 $('#clone_by_id').show();
70 70 $('#clone_url_id').hide();
71 71
72 72 // hide copy by id
73 73 $('#clone_by_name_copy').show();
74 74 $('#clone_by_id_copy').hide();
75 75
76 76 });
77 77 $('#clone_by_id').on('click',function(e){
78 78
79 79 // show url by id and hide id button
80 80 $('#clone_by_id').hide();
81 81 $('#clone_url_id').show();
82 82
83 83 // hide url by name and show id button
84 84 $('#clone_by_name').show();
85 85 $('#clone_url').hide();
86 86
87 87 // hide copy by id
88 88 $('#clone_by_id_copy').show();
89 89 $('#clone_by_name_copy').hide();
90 90 });
91 91
92 92 var initialCommitData = {
93 93 id: null,
94 94 text: 'tip',
95 95 type: 'tag',
96 96 raw_id: null,
97 97 files_url: null
98 98 };
99 99
100 100 select2RefSwitcher('#download_options', initialCommitData);
101 101
102 102 // on change of download options
103 103 $('#download_options').on('change', function(e) {
104 104 // format of Object {text: "v0.0.3", type: "tag", id: "rev"}
105 var ext = '.zip';
105 106 var selected_cs = e.added;
106 var fname= e.added.raw_id + ".zip";
107 var fname = e.added.raw_id + ext;
107 108 var href = pyroutes.url('repo_archivefile', {'repo_name': templateContext.repo_name, 'fname':fname});
108 109 // set new label
109 $('#archive_link').html('<i class="icon-archive"></i> '+ e.added.text+".zip");
110 $('#archive_link').html('<i class="icon-archive"></i> {0}{1}'.format(escapeHtml(e.added.text), ext));
110 111
111 112 // set new url to button,
112 113 $('#archive_link').attr('href', href)
113 114 });
114 115
115 116
116 117 // load details on summary page expand
117 118 $('#summary_details_expand').on('click', function() {
118 119
119 120 var callback = function (data) {
120 121 % if c.show_stats:
121 122 showRepoStats('lang_stats', data);
122 123 % endif
123 124 };
124 125
125 126 showRepoSize(
126 127 'repo_size_container',
127 128 templateContext.repo_name,
128 129 templateContext.repo_landing_commit,
129 130 callback);
130 131
131 132 })
132 133
133 134 })
134 135 </script>
135 136
136 137 </%def>
General Comments 0
You need to be logged in to leave comments. Login now