properly join URLs
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
if baseurls don't have a final slash, the function getCacheApiUrl constructs invalid URLS
Details
My CI runner baseurl is https://forgejo.ellis.link, however, CI jobs try to access
https://forgejo.ellis.link_apis/artifactcache/... (note the missing slash after the domain name)
The reason is here which does:
const url = `${baseUrl}_apis/artifactcache/${resource}`
Would it be possible to use a proper URL mangling function, eg.https://docs.rs/url/latest/url/struct.Url.html#method.join to handle cases both with final slash and without?
baseURL is very fragile as it is right now.
Contributor guide
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.
Research direction
Start in packages/cache/src/internal/cacheHttpClient.ts at the getCacheApiUrl construction cited in the issue. Check behavior with base URLs both with and without trailing slashes, then verify that the resulting cache API URL is valid in both cases and that the relevant existing coverage passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100