mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-05-10 18:53:43 +00:00
fix: namespace parsing in gitlab (#84)
* fix: namespace parsing in gitlab * test: add test for nested namespace --------- Co-authored-by: Andrea Lamparelli <a.lamparelli95@gmail.com>
This commit is contained in:
parent
e7c9b4795b
commit
ed32d2275b
6 changed files with 538 additions and 109 deletions
154
dist/cli/index.js
vendored
154
dist/cli/index.js
vendored
|
@ -1024,9 +1024,15 @@ class GitLabClient {
|
|||
* @returns {{owner: string, project: string}}
|
||||
*/
|
||||
extractMergeRequestData(mrUrl) {
|
||||
const elems = mrUrl.replace("/-/", "/").split("/");
|
||||
const { pathname } = new URL(mrUrl);
|
||||
const elems = pathname.substring(1).replace("/-/", "/").split("/");
|
||||
let namespace = "";
|
||||
for (let i = 0; i < elems.length - 3; i++) {
|
||||
namespace += elems[i] + "/";
|
||||
}
|
||||
namespace = namespace.substring(0, namespace.length - 1);
|
||||
return {
|
||||
namespace: elems[elems.length - 4],
|
||||
namespace: namespace,
|
||||
project: elems[elems.length - 3],
|
||||
id: parseInt(mrUrl.substring(mrUrl.lastIndexOf("/") + 1, mrUrl.length)),
|
||||
};
|
||||
|
@ -19253,7 +19259,7 @@ exports.suggestSimilar = suggestSimilar;
|
|||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
"use strict";
|
||||
// Axios v1.4.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||
// Axios v1.6.0 Copyright (c) 2023 Matt Zabriskie and contributors
|
||||
|
||||
|
||||
const FormData$1 = __nccwpck_require__(4334);
|
||||
|
@ -19823,8 +19829,9 @@ const reduceDescriptors = (obj, reducer) => {
|
|||
const reducedDescriptors = {};
|
||||
|
||||
forEach(descriptors, (descriptor, name) => {
|
||||
if (reducer(descriptor, name, obj) !== false) {
|
||||
reducedDescriptors[name] = descriptor;
|
||||
let ret;
|
||||
if ((ret = reducer(descriptor, name, obj)) !== false) {
|
||||
reducedDescriptors[name] = ret || descriptor;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -20608,10 +20615,6 @@ function formDataToJSON(formData) {
|
|||
return null;
|
||||
}
|
||||
|
||||
const DEFAULT_CONTENT_TYPE = {
|
||||
'Content-Type': undefined
|
||||
};
|
||||
|
||||
/**
|
||||
* It takes a string, tries to parse it, and if it fails, it returns the stringified version
|
||||
* of the input
|
||||
|
@ -20750,19 +20753,16 @@ const defaults = {
|
|||
|
||||
headers: {
|
||||
common: {
|
||||
'Accept': 'application/json, text/plain, */*'
|
||||
'Accept': 'application/json, text/plain, */*',
|
||||
'Content-Type': undefined
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
|
||||
utils.forEach(['delete', 'get', 'head', 'post', 'put', 'patch'], (method) => {
|
||||
defaults.headers[method] = {};
|
||||
});
|
||||
|
||||
utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
|
||||
defaults.headers[method] = utils.merge(DEFAULT_CONTENT_TYPE);
|
||||
});
|
||||
|
||||
const defaults$1 = defaults;
|
||||
|
||||
// RawAxiosHeaders whose duplicates are ignored by node
|
||||
|
@ -21096,7 +21096,17 @@ class AxiosHeaders {
|
|||
|
||||
AxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);
|
||||
|
||||
utils.freezeMethods(AxiosHeaders.prototype);
|
||||
// reserved names hotfix
|
||||
utils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {
|
||||
let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`
|
||||
return {
|
||||
get: () => value,
|
||||
set(headerValue) {
|
||||
this[mapped] = headerValue;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
utils.freezeMethods(AxiosHeaders);
|
||||
|
||||
const AxiosHeaders$1 = AxiosHeaders;
|
||||
|
@ -21216,7 +21226,7 @@ function buildFullPath(baseURL, requestedURL) {
|
|||
return requestedURL;
|
||||
}
|
||||
|
||||
const VERSION = "1.4.0";
|
||||
const VERSION = "1.6.0";
|
||||
|
||||
function parseProtocol(url) {
|
||||
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
|
||||
|
@ -21820,6 +21830,18 @@ const wrapAsync = (asyncExecutor) => {
|
|||
})
|
||||
};
|
||||
|
||||
const resolveFamily = ({address, family}) => {
|
||||
if (!utils.isString(address)) {
|
||||
throw TypeError('address must be a string');
|
||||
}
|
||||
return ({
|
||||
address,
|
||||
family: family || (address.indexOf('.') < 0 ? 6 : 4)
|
||||
});
|
||||
};
|
||||
|
||||
const buildAddressEntry = (address, family) => resolveFamily(utils.isObject(address) ? address : {address, family});
|
||||
|
||||
/*eslint consistent-return:0*/
|
||||
const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
||||
return wrapAsync(async function dispatchHttpRequest(resolve, reject, onDone) {
|
||||
|
@ -21830,15 +21852,16 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|||
let rejected = false;
|
||||
let req;
|
||||
|
||||
if (lookup && utils.isAsyncFn(lookup)) {
|
||||
lookup = callbackify$1(lookup, (entry) => {
|
||||
if(utils.isString(entry)) {
|
||||
entry = [entry, entry.indexOf('.') < 0 ? 6 : 4];
|
||||
} else if (!utils.isArray(entry)) {
|
||||
throw new TypeError('lookup async function must return an array [ip: string, family: number]]')
|
||||
}
|
||||
return entry;
|
||||
});
|
||||
if (lookup) {
|
||||
const _lookup = callbackify$1(lookup, (value) => utils.isArray(value) ? value : [value]);
|
||||
// hotfix to support opt.all option which is required for node 20.x
|
||||
lookup = (hostname, opt, cb) => {
|
||||
_lookup(hostname, opt, (err, arg0, arg1) => {
|
||||
const addresses = utils.isArray(arg0) ? arg0.map(addr => buildAddressEntry(addr)) : [buildAddressEntry(arg0, arg1)];
|
||||
|
||||
opt.all ? cb(err, addresses) : cb(err, addresses[0].address, addresses[0].family);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// temporary internal emitter until the AxiosRequest class will be implemented
|
||||
|
@ -22065,11 +22088,13 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|||
auth,
|
||||
protocol,
|
||||
family,
|
||||
lookup,
|
||||
beforeRedirect: dispatchBeforeRedirect,
|
||||
beforeRedirects: {}
|
||||
};
|
||||
|
||||
// cacheable-lookup integration hotfix
|
||||
!utils.isUndefined(lookup) && (options.lookup = lookup);
|
||||
|
||||
if (config.socketPath) {
|
||||
options.socketPath = config.socketPath;
|
||||
} else {
|
||||
|
@ -22143,7 +22168,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|||
delete res.headers['content-encoding'];
|
||||
}
|
||||
|
||||
switch (res.headers['content-encoding']) {
|
||||
switch ((res.headers['content-encoding'] || '').toLowerCase()) {
|
||||
/*eslint default-case:0*/
|
||||
case 'gzip':
|
||||
case 'x-gzip':
|
||||
|
@ -22239,7 +22264,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|||
}
|
||||
response.data = responseData;
|
||||
} catch (err) {
|
||||
reject(AxiosError.from(err, null, config, response.request, response));
|
||||
return reject(AxiosError.from(err, null, config, response.request, response));
|
||||
}
|
||||
settle(resolve, reject, response);
|
||||
});
|
||||
|
@ -22276,7 +22301,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
|
|||
// This is forcing a int timeout to avoid problems if the `req` interface doesn't handle other types.
|
||||
const timeout = parseInt(config.timeout, 10);
|
||||
|
||||
if (isNaN(timeout)) {
|
||||
if (Number.isNaN(timeout)) {
|
||||
reject(new AxiosError(
|
||||
'error trying to parse `config.timeout` to int',
|
||||
AxiosError.ERR_BAD_OPTION_VALUE,
|
||||
|
@ -22495,11 +22520,16 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|||
}
|
||||
}
|
||||
|
||||
let contentType;
|
||||
|
||||
if (utils.isFormData(requestData)) {
|
||||
if (platform.isStandardBrowserEnv || platform.isStandardBrowserWebWorkerEnv) {
|
||||
requestHeaders.setContentType(false); // Let the browser set it
|
||||
} else {
|
||||
requestHeaders.setContentType('multipart/form-data;', false); // mobile/desktop app frameworks
|
||||
} else if(!requestHeaders.getContentType(/^\s*multipart\/form-data/)){
|
||||
requestHeaders.setContentType('multipart/form-data'); // mobile/desktop app frameworks
|
||||
} else if(utils.isString(contentType = requestHeaders.getContentType())){
|
||||
// fix semicolon duplication issue for ReactNative FormData implementation
|
||||
requestHeaders.setContentType(contentType.replace(/^\s*(multipart\/form-data);+/, '$1'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22617,8 +22647,8 @@ const xhrAdapter = isXHRAdapterSupported && function (config) {
|
|||
// Specifically not if we're in a web worker, or react-native.
|
||||
if (platform.isStandardBrowserEnv) {
|
||||
// Add xsrf header
|
||||
const xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath))
|
||||
&& config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
// regarding CVE-2023-45857 config.withCredentials condition was removed temporarily
|
||||
const xsrfValue = isURLSameOrigin(fullPath) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
|
||||
|
||||
if (xsrfValue) {
|
||||
requestHeaders.set(config.xsrfHeaderName, xsrfValue);
|
||||
|
@ -22692,7 +22722,7 @@ const knownAdapters = {
|
|||
};
|
||||
|
||||
utils.forEach(knownAdapters, (fn, value) => {
|
||||
if(fn) {
|
||||
if (fn) {
|
||||
try {
|
||||
Object.defineProperty(fn, 'name', {value});
|
||||
} catch (e) {
|
||||
|
@ -22702,6 +22732,10 @@ utils.forEach(knownAdapters, (fn, value) => {
|
|||
}
|
||||
});
|
||||
|
||||
const renderReason = (reason) => `- ${reason}`;
|
||||
|
||||
const isResolvedHandle = (adapter) => utils.isFunction(adapter) || adapter === null || adapter === false;
|
||||
|
||||
const adapters = {
|
||||
getAdapter: (adapters) => {
|
||||
adapters = utils.isArray(adapters) ? adapters : [adapters];
|
||||
|
@ -22710,32 +22744,46 @@ const adapters = {
|
|||
let nameOrAdapter;
|
||||
let adapter;
|
||||
|
||||
const rejectedReasons = {};
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
nameOrAdapter = adapters[i];
|
||||
if((adapter = utils.isString(nameOrAdapter) ? knownAdapters[nameOrAdapter.toLowerCase()] : nameOrAdapter)) {
|
||||
let id;
|
||||
|
||||
adapter = nameOrAdapter;
|
||||
|
||||
if (!isResolvedHandle(nameOrAdapter)) {
|
||||
adapter = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
||||
|
||||
if (adapter === undefined) {
|
||||
throw new AxiosError(`Unknown adapter '${id}'`);
|
||||
}
|
||||
}
|
||||
|
||||
if (adapter) {
|
||||
break;
|
||||
}
|
||||
|
||||
rejectedReasons[id || '#' + i] = adapter;
|
||||
}
|
||||
|
||||
if (!adapter) {
|
||||
if (adapter === false) {
|
||||
throw new AxiosError(
|
||||
`Adapter ${nameOrAdapter} is not supported by the environment`,
|
||||
'ERR_NOT_SUPPORT'
|
||||
|
||||
const reasons = Object.entries(rejectedReasons)
|
||||
.map(([id, state]) => `adapter ${id} ` +
|
||||
(state === false ? 'is not supported by the environment' : 'is not available in the build')
|
||||
);
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
utils.hasOwnProp(knownAdapters, nameOrAdapter) ?
|
||||
`Adapter '${nameOrAdapter}' is not available in the build` :
|
||||
`Unknown adapter '${nameOrAdapter}'`
|
||||
let s = length ?
|
||||
(reasons.length > 1 ? 'since :\n' + reasons.map(renderReason).join('\n') : ' ' + renderReason(reasons[0])) :
|
||||
'as no adapter specified';
|
||||
|
||||
throw new AxiosError(
|
||||
`There is no suitable adapter to dispatch the request ` + s,
|
||||
'ERR_NOT_SUPPORT'
|
||||
);
|
||||
}
|
||||
|
||||
if (!utils.isFunction(adapter)) {
|
||||
throw new TypeError('adapter is not a function');
|
||||
}
|
||||
|
||||
return adapter;
|
||||
},
|
||||
adapters: knownAdapters
|
||||
|
@ -23066,15 +23114,13 @@ class Axios {
|
|||
// Set config.method
|
||||
config.method = (config.method || this.defaults.method || 'get').toLowerCase();
|
||||
|
||||
let contextHeaders;
|
||||
|
||||
// Flatten headers
|
||||
contextHeaders = headers && utils.merge(
|
||||
let contextHeaders = headers && utils.merge(
|
||||
headers.common,
|
||||
headers[config.method]
|
||||
);
|
||||
|
||||
contextHeaders && utils.forEach(
|
||||
headers && utils.forEach(
|
||||
['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
|
||||
(method) => {
|
||||
delete headers[method];
|
||||
|
@ -23484,6 +23530,8 @@ axios.AxiosHeaders = AxiosHeaders$1;
|
|||
|
||||
axios.formToJSON = thing => formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing);
|
||||
|
||||
axios.getAdapter = adapters.getAdapter;
|
||||
|
||||
axios.HttpStatusCode = HttpStatusCode$1;
|
||||
|
||||
axios.default = axios;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue