Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 593abb8

Browse files
committed
Generate url with startLine and endLine in correct order
1 parent 7e71795 commit 593abb8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/GitHub.Exports/Models/SimpleRepositoryModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ public UriString GenerateUrl(string path = null, int startLine = -1, int endLine
8484
path = path.Substring(LocalPath.Length + 1);
8585
}
8686

87+
if (startLine > 0 && endLine > 0 && startLine > endLine)
88+
{
89+
// if startLine is greater than endLine and both are set, swap them
90+
var temp = startLine;
91+
startLine = endLine;
92+
endLine = temp;
93+
}
94+
8795
return new UriString(GenerateUrl(CloneUrl.ToRepositoryUrl().AbsoluteUri, sha, path, startLine, endLine));
8896
}
8997

0 commit comments

Comments
 (0)