Comment #4 on issue 3558 by [email protected]: RB doesn't handle paths containing spaces correctly
https://code.google.com/p/reviewboard/issues/detail?id=3558

Hi everyone,

I've been looking into this issue quickly,
The problem comes from this code :

        diff_line = self.lines[linenum].split()

        try:
            # Need to remove the "a/" and "b/" prefix
            file_info.origFile = GIT_DIFF_PREFIX.sub(b"", diff_line[-2])
            file_info.newFile = GIT_DIFF_PREFIX.sub(b"", diff_line[-1])

Parsing this line :

diff --git a/File name with spaces.pdf b/File name with spaces.pdf


This will result in origFile = "with" and newFile = "spaces.pdf"


I was thinking about doing something like using regex

/a(.*)/b
/b(.*)$

But if you path looks like 'somefolder b/your file', this will fail again.

Other solution is to update file_info.origFile & file_info.newFile with regex as you read the file

Binary files /dev/null and b/File name with spaces.pdf differ <= 'Binary files /dev/null and b/(.*) differ'

But this mean adding code (with regex) for every condition in

        if self._is_new_file(linenum):
        elif self._is_deleted_file(linenum):
        elif self._is_mode_change(linenum):
        elif self._is_moved_file(linenum):
        elif self._is_copied_file(linenum):

If anyone thinks of a better way to deal with that, please let me know :)


--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"reviewboard-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/d/optout.

Reply via email to