Edgewall Software

Ticket #3020 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Browsing past sourcecode links to wrong filerevision

Reported by: fburmo@… Owned by: cboos
Priority: high Milestone: 0.9.5
Component: version control/browser Version: 0.9.4
Severity: major Keywords: browser revision plain text raw link
Cc:

Description

When browsing sourcecode for a past revision, the "Download in other formats"-links points to the wrong location.

example:

if I'm browsing this file: "browser/filename.java?rev=9", the link for the "Original file" points to: "/browser/filename.java?rev=1&format=raw"... which is the wrong revision of the file.

The "Plain text"-link is also wrong.

Attachments

Change History

Changed 2 years ago by fburmo@…

  • keywords browser revision plain text raw link added

Changed 2 years ago by cboos

  • owner changed from jonas to cboos
  • priority changed from normal to high
  • severity changed from normal to major
  • milestone set to 0.9.5

Would you mind testing the following patch?

Index: trac/versioncontrol/web_ui/browser.py
===================================================================
--- trac/versioncontrol/web_ui/browser.py	(revision 3110)
+++ trac/versioncontrol/web_ui/browser.py	(working copy)
@@ -199,8 +199,7 @@
             content = node.get_content().read(mimeview.max_preview_size())
             if not is_binary(content):
                 if mime_type != 'text/plain':
-                    plain_href = self.env.href.browser(node.path,
-                                                       rev=rev and node.rev,
+                    plain_href = self.env.href.browser(node.path, rev=rev,
                                                        format='txt')
                     add_link(req, 'alternate', plain_href, 'Plain Text',
                              'text/plain')
@@ -209,8 +208,7 @@
                                                       node.name, node.rev,
                                                       annotations=['lineno'])
 
-            raw_href = self.env.href.browser(node.path, rev=rev and node.rev,
-                                             format='raw')
+            raw_href = self.env.href.browser(node.path, rev=rev, format='raw')
             req.hdf['file.raw_href'] = raw_href
             add_link(req, 'alternate', raw_href, 'Original Format', mime_type)

Changed 2 years ago by mgood

Are you sure that revision is really the wrong one? The links will use the version number of when the file was actually changed. If you're looking at a file at version 9, but that file wasn't modified between versions 1 and 9, then the links will point to version 1, which is actually the same file.

Changed 2 years ago by cboos

  • status changed from new to assigned

Matt, I believe this bug is most certainly a duplicate of #2949, which manifests itself when the file has been moved in between the two revs (e.g. if in the above example, the filename.java doesn't exist at rev 1).

This was fixed in trunk, but I think we should fix it also in 0.9-stable.

Changed 2 years ago by cboos

  • status changed from assigned to closed
  • resolution set to fixed

Fixed by r3133.

Add/Change #3020 (Browsing past sourcecode links to wrong filerevision)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.