481: Expand of diff chunks doesn't work if Review Board is installed in a subdirectory

bno***@mindspr******* (Google Code) (Is this you? Claim this profile.)
May 8, 2008
What's the URL of the page containing the problem?
http://localhost/reviewboard/r/4/diff/#

What steps will reproduce the problem?
1. Install Review Board in a subdirectory of Apache (using fastcgi)
2. Try to expand a single diff chunk while viewing a diff

What is the expected output? What do you see instead?
Expect the hidden chunk to expand, instead nothing happens.
Apache logs show a 404:
 "GET /r/4/diff/3/fragment/45/chunk/0/ HTTP/1.1" 404

What operating system are you using? What browser?
Ubuntu Linux (Gutsy Gibbon), Firefox 2.0.0.11

Please provide any additional information below.
Seems like "expandChunk" in diffviewer.js needs to account
for SITE_ROOT. Naive (but working) patch attached.
Index: htdocs/media/rb/scripts/diffviewer.js
===================================================================
--- htdocs/media/rb/scripts/diffviewer.js	(revision 1328)
+++ htdocs/media/rb/scripts/diffviewer.js	(working copy)
@@ -773,7 +773,7 @@
       revision += "-" + gInterdiffRevision;
     }
 
-    var url = '/r/' + gReviewRequestId + '/diff/' + revision +
+    var url = SITE_ROOT + 'r/' + gReviewRequestId + '/diff/' + revision +
               '/fragment/' + filediff_id + '/chunk/' + chunk_index + '/';
     YAHOO.util.Connect.asyncRequest("GET", url, {
         success: function(res) {
chipx86
#1 chipx86
  • +Fixed