-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
Description
strconv.ParseInt: parsing "number": invalid syntax
Steps to reproduce:
- Create a repository with actions enabled
- Create a file
/.gitea/workflows
with the contentnot a number
- Create a file
/.github/workflows
with the contentnot a number
- Open the page
/<owner>/<repo>/actions
- If no error is shown, refresh the page multiple times until an error occurs
The reason is this code
gitea/modules/actions/workflows.go
Lines 47 to 50 in ce9978b
tree, err := commit.SubTree(".gitea/workflows") | |
if _, ok := err.(git.ErrNotExist); ok { | |
tree, err = commit.SubTree(".github/workflows") | |
} |
which fails in line 179
gitea/modules/git/batch_reader.go
Lines 152 to 181 in ce9978b
func ReadBatchLine(rd *bufio.Reader) (sha []byte, typ string, size int64, err error) { | |
typ, err = rd.ReadString('\n') | |
if err != nil { | |
return sha, typ, size, err | |
} | |
if len(typ) == 1 { | |
typ, err = rd.ReadString('\n') | |
if err != nil { | |
return sha, typ, size, err | |
} | |
} | |
idx := strings.IndexByte(typ, ' ') | |
if idx < 0 { | |
log.Debug("missing space typ: %s", typ) | |
return sha, typ, size, ErrNotExist{ID: string(sha)} | |
} | |
sha = []byte(typ[:idx]) | |
typ = typ[idx+1:] | |
idx = strings.IndexByte(typ, ' ') | |
if idx < 0 { | |
return sha, typ, size, ErrNotExist{ID: string(sha)} | |
} | |
sizeStr := typ[idx+1 : len(typ)-1] | |
typ = typ[:idx] | |
size, err = strconv.ParseInt(sizeStr, 10, 64) | |
return sha, typ, size, err | |
} |
If the error occurs the code tries to parse not a number
as output of the batch reader. A normal output looks like 8b2bfd3a117fcb7ae93f93616cb2f7a9706c513a tree 104
. I don't know how the content of a file can be present here. And even worse is that it does not fail every time. If I create only one workflows
file it does not fail but that may just be a timing issue.
Git Version
2.43.0, non-gogit
yp05327