mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
* fix(sec): cve-2024-39338 (#6539) * fix(sec): fix test
This commit is contained in:
@@ -229,7 +229,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
||||
|
||||
// Parse url
|
||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||
const parsed = new URL(fullPath, 'http://localhost');
|
||||
const parsed = new URL(fullPath, utils.hasBrowserEnv ? platform.origin : undefined);
|
||||
const protocol = parsed.protocol || supportedProtocols[0];
|
||||
|
||||
if (protocol === 'data:') {
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
||||
*/
|
||||
export default function isAbsoluteURL(url) {
|
||||
// A URL is considered absolute if it begins with "<scheme>://".
|
||||
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
||||
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
||||
// by any combination of letters, digits, plus, period, or hyphen.
|
||||
return /^([a-z][a-z\d+\-.]*:)\/\//i.test(url);
|
||||
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user