Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

#3020 closed defect (fixed)

Browsing past sourcecode links to wrong filerevision

Reported by: fburmo@… Owned by: Christian Boos
Priority: high Milestone: 0.9.5
Component: version control/browser Version: 0.9.4
Severity: major Keywords: browser revision plain text raw link
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

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 (0)

Change History (5)

comment:1 by fburmo@…, 18 years ago

Keywords: browser revision plain text raw link added

comment:2 by Christian Boos, 18 years ago

Milestone: 0.9.5
Owner: changed from Jonas Borgström to Christian Boos
Priority: normalhigh
Severity: normalmajor

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)

comment:3 by Matthew Good, 18 years ago

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.

comment:4 by Christian Boos, 18 years ago

Status: newassigned

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.

comment:5 by Christian Boos, 18 years ago

Resolution: fixed
Status: assignedclosed

Fixed by r3133.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.