Fix baseURL double-prefix when request path starts with /#3
Merged
Conversation
Agent-Logs-Url: https://github.com/dev-dami/kiattp/sessions/5761a7d0-5bf0-440b-9347-d3a3f6abbc83 Co-authored-by: dev-dami <141376183+dev-dami@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dev-dami/kiattp/sessions/5761a7d0-5bf0-440b-9347-d3a3f6abbc83 Co-authored-by: dev-dami <141376183+dev-dami@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix baseURL ignored when request path starts with /
Fix baseURL double-prefix when request path starts with /
Apr 6, 2026
Removed comments explaining the stripping of baseURL and url from instanceConfig.
dev-dami
approved these changes
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
axios.create({ baseURL: '/api' })with a path starting with/, thebaseURLwas applied twice — producing/api/api/auth/logininstead of/api/auth/login— causing a URL parse failure.Root Cause
src/instance.tscallsbuildUrl()to resolve the full URL, then passes the entireinstanceConfig(still containingbaseURL) tocore/request.ts. Sincecore/request.tscallsbuildUrl()again, relativebaseURLvalues got applied a second time. AbsolutebaseURLswere unaffected because the resulting URL passesisAbsoluteUrl()and is used as-is.Fix
Strip
baseURLandurlfrominstanceConfigbefore handing off tocore/request.ts, since URL resolution is already complete at that point.Tests
test/unit/instance-baseurl.test.ts: stubsglobal.fetchto assert the exact URL sent —/api/auth/login, not/api/api/auth/logintest/axios/compatibility.test.ts: adds an integration case foraxios.createwith abaseURLcontaining a path segment and a leading-slash request pathWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.example.com/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions development --conditions node /home/REDACTED/work/kiattp/kiattp/node_modules/tinypool/dist/entry/process.js(dns block)/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions development --conditions node /home/REDACTED/work/kiattp/kiattp/node_modules/tinypool/dist/entry/process.js b.com/dev-dami/kiattp/sessions/5761a7d0-5bf0-440b-9347-d3a3f6abbc83 k/_temp/ghcca-node/node/bin/git logs s ost:*;127.0.0.1;--noprofile /home/REDACTED/work/_temp/ghcca-node/node/bin/node --en�� /home/REDACTED/work/_temp/copilot-developer-action-main/dist/indexcredential.helper(dns block)/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions development --conditions node /home/REDACTED/work/kiattp/kiattp/node_modules/tinypool/dist/entry/process.js --global tnet/tools/git user.name(dns block)this-host-does-not-exist-xyz123.test/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions development --conditions node /home/REDACTED/work/kiattp/kiattp/node_modules/tinypool/dist/entry/process.js(dns block)/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions development --conditions node /home/REDACTED/work/kiattp/kiattp/node_modules/tinypool/dist/entry/process.js --global 1/x64/bin/node user.name(dns block)/opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --conditions development --conditions node /home/REDACTED/work/kiattp/kiattp/node_modules/tinypool/dist/entry/process.js aseurl.test.ts node_modules/.bin/sh(dns block)If you need me to access, download, or install something from one of these locations, you can either: