Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit e581524

Browse files
authored
Merge pull request #2305 from wadethestealth/fix-#2302
Normalize comment path
2 parents 505223a + 488a2a9 commit e581524

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/views/reviews-view.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ export default class ReviewsView extends React.Component {
627627
lineNumber = null;
628628
positionText = 'outdated';
629629
} else {
630-
const translationsForFile = translations.get(rootComment.path);
630+
const translationsForFile = translations.get(path.normalize(rootComment.path));
631631
lineNumber = translationsForFile.diffToFilePosition.get(parseInt(rootComment.position, 10));
632632
if (translationsForFile.fileTranslations && isCheckedOutPullRequest) {
633633
lineNumber = translationsForFile.fileTranslations.get(lineNumber).newPosition;

test/views/reviews-view.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ describe('ReviewsView', function() {
235235
.addReviewThread(t => {
236236
t.thread(t0 => t0.id('abcd'));
237237
t.addComment(c =>
238-
c.id(0).path('dir/file0').position(10).bodyHTML('i have opinions.').author(a => a.login('user0').avatarUrl('user0.jpg')),
238+
c.id(0).path('dir/file0').position(10).bodyHTML('i have a bad windows file path.').author(a => a.login('user0').avatarUrl('user0.jpg')),
239239
);
240240
t.addComment(c =>
241241
c.id(1).path('file0').position(10).bodyHTML('i disagree.').author(a => a.login('user1').avatarUrl('user1.jpg')).isMinimized(true),
@@ -267,7 +267,7 @@ describe('ReviewsView', function() {
267267
const rootComment = thread.comments[0];
268268
const diffToFilePosition = new Map();
269269
diffToFilePosition.set(rootComment.position, rootComment.position);
270-
commentTranslations.set(rootComment.path, {diffToFilePosition});
270+
commentTranslations.set(path.normalize(rootComment.path), {diffToFilePosition});
271271
});
272272

273273
wrapper = shallow(buildApp({openIssueish, summaries, commentThreads, resolveThread, unresolveThread, addSingleComment, commentTranslations}));

0 commit comments

Comments
 (0)