fix(repos): return the file body and allow the root path #16
No reviewers
Labels
No labels
area/dsh
area/forgejo
experiment
priority/later
priority/next
priority/now
type/bug
type/task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
dsh-plugins/dsh-gitea!16
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/3-repo-contents-body"
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?
What
gitea_repo_contentsreturned a filename instead of the file:Two causes:
formatToolResulthitif (data.path) return data.pathbefore any content-aware branch, andgetContents()rejected an empty path so the root (an array response) was unreachable.This PR:
gitea_repo_contentsformatter: base64-decodes files, showsFile: <path> (<size>, encoding),html_urlanddownload_url;… [truncated … download the full file at …]note;path: ""and requests/contentsfor the repository root (generic listing handles the array);../) and path segment encoding.Verification
test/repo-contents.test.mjs: body + links, unicode round-trip, 25 000-char truncation bound, empty/missing content, root/contentsURL, path encoding and traversal rejection.npm test66/66, leak scan clean,node --checkclean.AGENTS.md→File: AGENTS.md (38003 bytes, encoding: base64)+ body, truncated at 20 000 chars with the download link;path: ""→ root listing (.forgejo,AGENTS.md,lib, …).Acceptance (from #3)
AGENTS.md→ first ~20 KB of text plus a download link.Closes #3.