Skip to content

Commit f256c95

Browse files
committed
changed repo url generator logic
1 parent 46cc5ab commit f256c95

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

lib/utils.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const fs = require("fs-extra");
22
const chalk = require("chalk");
3+
const nodeUrl = require("url");
34

45
class Utils {
56
/**
@@ -72,7 +73,12 @@ class Utils {
7273
* @param {string} httpUrlToRepo http url of repo
7374
*/
7475
generateRepoUrl(httpUrlToRepo) {
75-
return httpUrlToRepo.replace("https://", `https://oauth2:${this.token}@`);
76+
const parsedUrl = nodeUrl.parse(httpUrlToRepo);
77+
78+
return parsedUrl.href.replace(
79+
parsedUrl.host,
80+
`oauth2:${this.token}@${parsedUrl.host}`
81+
);
7682
}
7783
}
7884

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mmd-gitlab-backuper",
33
"description": "a package to backup from all projects that you have on gitlab",
4-
"version": "1.4.1",
4+
"version": "1.5.0",
55
"main": "lib/index.js",
66
"license": "MIT",
77
"author": {

0 commit comments

Comments
 (0)