mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-04-24 20:32:14 +00:00
fix: namespace parsing in gitlab
This commit is contained in:
parent
e7c9b4795b
commit
867e3710bd
1 changed files with 11 additions and 2 deletions
|
@ -181,9 +181,18 @@ export default class GitLabClient implements GitClient {
|
||||||
* @returns {{owner: string, project: string}}
|
* @returns {{owner: string, project: string}}
|
||||||
*/
|
*/
|
||||||
private extractMergeRequestData(mrUrl: string): {namespace: string, project: string, id: number} {
|
private extractMergeRequestData(mrUrl: string): {namespace: string, project: string, id: number} {
|
||||||
const elems: string[] = mrUrl.replace("/-/", "/").split("/");
|
const { pathname } = new URL(mrUrl);
|
||||||
|
const elems: string[] = 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 {
|
return {
|
||||||
namespace: elems[elems.length - 4],
|
namespace: namespace,
|
||||||
project: elems[elems.length - 3],
|
project: elems[elems.length - 3],
|
||||||
id: parseInt(mrUrl.substring(mrUrl.lastIndexOf("/") + 1, mrUrl.length)),
|
id: parseInt(mrUrl.substring(mrUrl.lastIndexOf("/") + 1, mrUrl.length)),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue