0
Fork 0
mirror of https://github.com/thomiceli/opengist.git synced 2025-02-12 01:48:02 -05:00

Log parser with maxBytes variable

This commit is contained in:
Thomas Miceli 2023-04-05 18:20:50 +02:00
parent c3940933bb
commit 9fadfe7cde
No known key found for this signature in database
GPG key ID: D86C6F6390AF050F
2 changed files with 3 additions and 3 deletions

View file

@ -126,7 +126,7 @@ func GetLog(user string, gist string, skip string) ([]*Commit, error) {
return nil, err
}
return parseLog(stdout), nil
return parseLog(stdout, 2<<18), nil
}
func CloneTmp(user string, gist string, gistTmpId string, email string) error {

View file

@ -61,7 +61,7 @@ func truncateCommandOutput(out io.Reader, maxBytes int64) (string, bool, error)
return string(buf), truncated, nil
}
func parseLog(out io.Reader) []*Commit {
func parseLog(out io.Reader, maxBytes int) []*Commit {
scanner := bufio.NewScanner(out)
var commits []*Commit
@ -164,7 +164,7 @@ func parseLog(out io.Reader) []*Commit {
currentFile.Content += string(line) + "\n"
bytesRead += len(line)
if bytesRead > 2<<18 {
if bytesRead > maxBytes {
currentFile.Truncated = true
currentFile.Content = ""
isContent = false