properly join URLs

Open Beginner friendly
#2,375 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
api

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.

Description

bug

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.

Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from actions/toolkit

All issues in actions/toolkit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.