mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-29 20:54:22 +01:00
fixing a location off by one edge case for --no-git (#812)
This commit is contained in:
1 parent
31ff8677dd
commit
ba9e089e35
2 files changed
+10
-11
No files matched your search
+2
-3
@@ -22,7 +22,6 @@ func location(fragment Fragment, matchIndex []int) Location {
|
||||
end := matchIndex[1]
|
||||
|
||||
for lineNum, pair := range fragment.newlineIndices {
|
||||
_lineNum = lineNum
|
||||
newLineByteIndex := pair[0]
|
||||
if prevNewLine <= start && start < newLineByteIndex {
|
||||
lineSet = true
|
||||
@@ -46,8 +45,8 @@ func location(fragment Fragment, matchIndex []int) Location {
|
||||
// a newline
|
||||
location.startColumn = (start - prevNewLine) + 1 // +1 because counting starts at 1
|
||||
location.endColumn = (end - prevNewLine)
|
||||
location.startLine = _lineNum
|
||||
location.endLine = _lineNum
|
||||
location.startLine = _lineNum + 1
|
||||
location.endLine = _lineNum + 1
|
||||
location.startLineIndex = start
|
||||
|
||||
// search for new line byte index
|
||||
|
||||
Reference in new issue
Block a user