Comment #4 on issue 3558 by RB doesn't handle paths containing spaces correctly

Hi everyone,

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

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

            # 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


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:

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 post to this group, send email to
Visit this group at
For more options, visit

Reply via email to