Break apart Contents Abstraction
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with GithubRepo.get_contents and the linked GitHub Contents API documentation, then trace its callers to distinguish directory and file intent. Define separate behavior for directories and files, including the raw-media fallback for files between 1MB and 100MB; the issue also requires deciding whether files over 100MB must be supported.
Written by the indexing model from the issue text.
Description
We currently have GithubRepo.get_contents as an abstraction around GitHub's Contents API endpoint. However, this endpoint behaves differently depending on what you're asking it for, in particular:
- a directory
- a file
- a file whose size is between 1MB and 100MB
- a file whose size is above 100MB
The method tries to handle those all in one place and the flow suffers because of it.
Instead we should pick apart this abstraction into two, based on the caller's intent:
- a directory
- a file, with fallbacks for larger files
For instance, file content for files between 1MB and 100MB can be retrieved with the application/vnd.github.v3.raw custom media type (as the Accept header). Since we already want the metadata from the initial call (it's not provided with a raw call) this seems like a nice fallback. We can discuss whether we need to support retrieving file content which is >100MB.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 9
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from opensafely-core/osgithub
-
dependency-management
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
opensafely-core/osgithub#289 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
opensafely-core/osgithub#269 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
opensafely-core/osgithub#242 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
opensafely-core/osgithub#236 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
opensafely-core/osgithub#230 · 1 comment ·
All issues in opensafely-core/osgithub
Similar issues
-
agent-ready documentation needs-triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
instance instance add
Difficulty 1/5 Under an hour Newbie friendliness 72/100
searxng/searx-instances#939 · 1 comment ·
-
area-deployment area-integrations triage:bot-seen
Difficulty 2/5 Half a day Newbie friendliness 86/100