Skip to content

Commit

Permalink
feat(backend/utils): follow symlink to get file contents
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed May 2, 2023
1 parent 69c8e80 commit 94ae6c8
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions server/backend/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,24 @@ func LatestFile(r Repository, pattern string) (string, string, error) {
return "", "", err
}
for _, e := range ents {
fp := filepath.Join(dir, e.Name())
if e.IsTree() {
te := e
fp := filepath.Join(dir, te.Name())
if te.IsTree() {
continue
}
if g.Match(fp) {
bts, err := e.Contents()
if te.IsSymlink() {
bts, err := te.Contents()
if err != nil {
return "", "", err
}
fp = string(bts)
te, err = t.TreeEntry(fp)
if err != nil {
return "", "", err
}
}
bts, err := te.Contents()
if err != nil {
return "", "", err
}
Expand Down

0 comments on commit 94ae6c8

Please sign in to comment.