408: Uploading a diff doesn't work if reviewboard is hosted on windows

michael.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Feb. 24, 2008
What's the URL of the page containing the problem?
* http://192.168.174.129:8081/r/new/
* post-review 

What steps will reproduce the problem?
1. Install reviewboard on a windows system with XAMPP.
2a. Try to upload a diff on the "New review request" page
2b. Try to upload a diff with the post-review tool

What is the expected output? What do you see instead?
Expected: diff is uploaded an review created
Result: The file '/xyz\abc.txt' (r29) could not be found in the repository"

What operating system are you using? What browser?
WinXP
IE 6, Firefox 2, Safari

Please provide any additional information below.
The problem is, that diffviewers/form.py uses os.path.join, which is too
smart in this case. It uses the os specific file separator, which is "\" on
windows. But a "/" is needed here.

I've attached a patch. It's just a quick hack, but it works. There may be
better solutions, but I'm no python expert.
Index: diffviewer/forms.py
===================================================================
--- diffviewer/forms.py	(revision 1175)
+++ diffviewer/forms.py	(working copy)
@@ -47,7 +47,7 @@
 
         for f in files:
             f2, revision = tool.parse_diff_revision(f.origFile, f.origInfo)
-            filename = os.path.join(basedir, f2)
+            filename = os.path.join(basedir, f2).replace("\\", "/")
 
             # FIXME: this would be a good place to find permissions errors
             if revision != PRE_CREATION and revision != UNKNOWN and \
@@ -69,7 +69,7 @@
         for f in files:
             filediff = FileDiff(diffset=diffset,
                                 source_file=f.origFile,
-                                dest_file=os.path.join(basedir, f.newFile),
+                                dest_file=os.path.join(basedir, f.newFile).replace("\\", "/"),
                                 source_revision=smart_unicode(f.origInfo),
                               
david
#1 david
Fixed in SVN.  Thanks!
  • +Fixed