Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#5295 closed enhancement (fixed)

[PATCH] Allow "live browsing" of repository contents

Reported by: christian.seiler@… Owned by: Christian Boos
Priority: normal Milestone: 0.10.5
Component: version control/browser Version: 0.10-stable
Severity: normal Keywords: export
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Trac provides a way to view the original format of a file (if render_unsafe_content is set to true). The problem is that this simply adds the ?format=raw parameter to the URL. If I view a HTML file with relative links, images, stylesheet, scripts etc. the links will remain the same and an <img src="foo.png" alt=""> will simply cause the browser to not display the image because Trac will only return the original image if <img src="foo.png?format=raw" alt=""> would be specified.

Of course, modifying all links inside HTML files when displaying them as original format is error-prone, inelegant, time-consuming and would pervert the meaning of original format.

ViewVC comes with a clever idea of how to solve this - if a the revision log of a file is accessible through viewvc/path/to/file.html - then viewvc/*checkout*/path/to/file.html will send the contents of that file to the browser - and relative links will work.

I've writen a small patch that makes Trac use /browser/!raw/* instead of /browser/*?format=raw.

Attachments (1)

trac-browser.patch (1.1 KB ) - added by christian.seiler@… 17 years ago.

Download all attachments as: .zip

Change History (9)

by christian.seiler@…, 17 years ago

Attachment: trac-browser.patch added

comment:1 by Christian Boos, 17 years ago

Resolution: duplicate
Status: newclosed

Thanks for the patch, but I already did this a few months ago ;-)

Duplicate of #3579. See [4242] for the current implementation in 0.11.

comment:2 by christian.seiler@…, 17 years ago

Ups, sorry for the duplicate, I just didn't search for similar bugs in "version control" - only in "browser".

I applied the patch to my installed 0.10 and it works fine (and is even better than my quick solution), so it's not 0.11 specific. Since 0.11 will still take some time until it's finished, would it be possible to merge the patch back to the 0.10 branch?

comment:3 by Christian Boos, 17 years ago

Well, if you have a patch that applies cleanly to 0.10-stable and did some extensive testing, then yes. Otherwise, we try to limit 0.10-stable to bug fixes only.

comment:4 by Christian Boos, 17 years ago

(I mean, the backported functionality should be a backport of r4242, not my initial patch on #3579 which was slightly different, IIRC)

comment:5 by christian.seiler@…, 17 years ago

I didn't backport anything - the changeset r4242 applies to the 0.10 without any problem. (Well ok, there are a few lines offset while applying the patch, but that doesn't matter at all.)

I tested it on my local machine (x86 arch, Python 2.4, Trac 0.10.4) with a test repository with some simple test data and on test Trac 0.10.4 installation on a server (amd64 arch, Python 2.4) with a production respository containing *lots* of HTML, Stylesheets, Scripts and Images. Works perfectly, as far as I can tell. I can give no guarantee, of course. ;-)

comment:6 by Christian Boos, 17 years ago

Milestone: 0.10.5
Resolution: duplicate
Status: closedreopened

Oh, right, r4242 was not that far away from 0.10 ;-)

Did you try the export:... TracLinks as well?

comment:7 by christian.seiler@…, 17 years ago

Now I did and yes, they work.

comment:8 by Christian Boos, 17 years ago

Keywords: export added
Resolution: fixed
Status: reopenedclosed

Ok, fine, feature ported in r5370, thanks for your help!

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.