bug: ListContents fails when path is a file (object vs array response) #73
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
When
ListContents()is called with a path that points to a file (not a directory), Gitea returns a single JSON object:But the code tries to unmarshal it as an array:
This fails with:
json: cannot unmarshal object into Go value of type []gitea.ContentEntryHow to Trigger
patterns-files: README.md(or let it default to that per #71)ListContents(ctx, owner, repo, "README.md")Fix
Detect single-object response and handle it:
Or check the response structure before unmarshaling.
Related
.path normalizationREADME.md