Ticket #5249: browser.diff
| File browser.diff, 1.9 KB (added by dan@…, 21 months ago) |
|---|
-
browser.py
57 57 glob patterns, i.e. "*" can be used as a wild card) 58 58 (''since 0.10'')""") 59 59 60 project_root = Option('browser', 'project_root', '', 61 """The root of the project in the repository. 62 63 This tells trac to treat the specified path as the root of the repository. 64 65 Omit the option to use the actual root of the repository as the root of the project.""") 66 60 67 render_unsafe_content = BoolOption('browser', 'render_unsafe_content', 61 68 'false', 62 69 """Whether attachments should be rendered in the browser, or … … 100 107 return True 101 108 102 109 def process_request(self, req): 103 path = req.args.get('path', '/')110 path = self.project_root + req.args.get('path', '/') 104 111 rev = req.args.get('rev') or None 105 112 106 113 # Find node for the requested path/rev … … 133 140 'anydiff_href': req.href.anydiff(), 134 141 } 135 142 136 path_links = get_path_links(req.href, path, rev) 143 relative_path = path.replace(self.project_root, '', 1) 144 path_links = get_path_links(req.href, relative_path, rev) 137 145 if len(path_links) > 1: 138 146 add_link(req, 'up', path_links[-2]['href'], 'Parent directory') 139 147 req.hdf['browser.path'] = path_links … … 163 171 'size': pretty_size(entry.content_length), 164 172 'rev': entry.rev, 165 173 'log_href': req.href.log(entry.path, rev=rev), 166 'browser_href': req.href.browser(entry.path, rev=rev) 174 'browser_href': req.href.browser(entry.path, rev=rev).replace(self.project_root+'/', '', 1) 167 175 }) 168 176 changes = get_changes(self.env, repos, [i['rev'] for i in info]) 169 177
