------------------------------------------------------------------------------
To reply, visit https://hellosplat.com/s/beanbag/tickets/4617/
------------------------------------------------------------------------------
New ticket #4617 by jhominal
For Beanbag, Inc. > Review Board
Status: New
Tags: Priority:Medium, Type:Defect
------------------------------------------------------------------------------
Diff fragments do not load correctly when the fragment contains non-ASCII
characters
==============================================================================
# What version are you running?
3.0.0
# What's the URL of the page containing the problem?
/r/{review-request-id}/
# What steps will reproduce the problem?
1. File a review request with a new file with at least two lines containing
non-ASCII characters
2. Create a review with two diff comments, one for each line containing
non-ASCII characters
3. Publish the review
# What is the expected output? What do you see instead?
Expected: The page works as expected.
Actual output: One of the comments does not load at all, and the other
comment's html contains some extra characters (that match the starting digits
of the ID of the non-loading comment)
# What operating system are you using? What browser?
Windows, on Chrome and Firefox.
# Please provide any additional information below.
The root cause of this bug is a mismatch in the reported HTML length on the
route `/r/{review_request_id}/_fragments/diff-comments/{diff_comment_id}/` -
that is, by looking at [the source
code](https://github.com/reviewboard/reviewboard/blob/master/reviewboard/reviews/views.py#L1425-L1430),
the written length for the HTML is a UTF-8 byte count, but the Javascript code
uses that length as a unicode character count - these two counts do not match
when non-ASCII characters are present.
I have been able to patch on my instance that issue by replacing line 1429 with:
payload.write(b'%d\n' % len(html.decode('utf-8')))
That is, I do an additional decode in order to get the real unicode character
length.
------------------------------------------------------------------------------
--
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 https://groups.google.com/group/reviewboard-issues.
For more options, visit https://groups.google.com/d/optout.