{{ message }}
fix(buildURL): reject nullish url instead of coercing it to an empty string - #11162
Open
lazerg wants to merge 4 commits into
Open
fix(buildURL): reject nullish url instead of coercing it to an empty string#11162lazerg wants to merge 4 commits into
lazerg wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
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.

Summary
#10959 added
url = url || ''tobuildURLto stop aTypeErrorwhen params were passed with an undefined url. That guard also changed what a nullish url means.axios.get(null, { params })used to blow up before any request went out; since 1.18.1 it builds?foo=bar, which the browser resolves against the current page, so the app silently fires a request at itself.The empty string is a legitimate relative url and should keep working.
nullandundefinedare not, and they should not quietly become one. This restores the fail-fast behavior without bringing back the rawTypeError: a non-string url with params now throws anAxiosErrorcarryingERR_INVALID_URL, the same codebuildFullPathalready uses for unusable urls. Values such as0,falseand aURLinstance previously reachedurl.indexOfand died with a bareTypeError, so they are covered by the same check. A url that comes frombaseURLalone is unaffected, sincecombineURLshas already turned it into a string by then.Scope is deliberately limited to the params path, which is the part #10959 changed.
axios.get(null)without params returns early atif (!params)and behaves exactly as it did before 1.18.1.Linked issue
Closes #11160
Changes
lib/helpers/buildURL.js: throwAxiosError/ERR_INVALID_URLfor a non-string url instead of coercing it to''.tests/unit/helpers/buildURL.test.js: cover the rejection and keep the empty-string case explicit.tests/unit/helpers/resolveConfig.test.js: regression test for the reported path, a null url plus params no longer resolves to the current page.PRE_RELEASE_CHANGELOG.md: note the fix.Testing
npx eslint lib/helpers/buildURL.jsnpm run test:vitest:unit— 58 files, 1,064 tests passedChecklist