mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-28 04:04:25 +01:00
fix(git-symlink-commits): fix handling symbolic links in a git repository (#612)
This commit is contained in:
1 parent
127df8a6f0
commit
a32ef6afc4
1 file changed
+4
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -156,6 +157,9 @@ func (us *UnstagedScanner) Scan() (Report, error) {
|
||||
// file in staging has been deleted, aka it is not on the filesystem
|
||||
// so the contents of the file are ""
|
||||
currFileContents = ""
|
||||
//check if file is symlink
|
||||
} else if fc, err := os.Readlink(fn); err == nil {
|
||||
currFileContents = fc
|
||||
} else {
|
||||
workTreeBuf := bytes.NewBuffer(nil)
|
||||
workTreeFile, err := wt.Filesystem.Open(fn)
|
||||
|
||||
Reference in new issue
Block a user