Skip to content

Commit 3e01bb1

Browse files
committed
Fix comment
1 parent ba2d7ce commit 3e01bb1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pkg/github/repositories.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,13 +612,11 @@ func GetFileContents(getClient GetClientFn, getRawClient raw.GetRawClientFn, t t
612612
ref = rawOpts.SHA
613613
}
614614

615-
// If the path is (most likely) not to be a directory, we will
616-
// first try to get the raw content from the GitHub raw content API.
617-
618615
var rawAPIResponseCode int
619-
// First, get file info from Contents API to retrieve SHA
620616
var fileSHA string
621617
opts := &github.RepositoryContentGetOptions{Ref: ref}
618+
619+
// Always call GitHub Contents API first to get metadata including SHA and determine if it's a file or directory
622620
fileContent, dirContent, respContents, err := client.Repositories.GetContents(ctx, owner, repo, path, opts)
623621
if respContents != nil {
624622
defer func() { _ = respContents.Body.Close() }()

0 commit comments

Comments
 (0)