Skip to content

Commit b9cf1c4

Browse files
committed
added next url generator in utils
1 parent 5ab1352 commit b9cf1c4

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function main() {
180180
* based on gitlab document, if our array length is 0 and link also is no absence then we have all of our repos data.
181181
*/
182182
if (length !== 0 && link) {
183-
next = link.replace("<http", "http").replace(`>; rel="next"`, "");
183+
next = Utils.generateNextLink(link);
184184

185185
/**
186186
* after saving next url that should be called, we call again our main function.

lib/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ class Utils {
2020
return chalk.cyan(name);
2121
}
2222

23+
/**
24+
* generate next link url that should be called for our pagination process.
25+
* @param {string} link link url returned from gitlab api response
26+
*/
27+
static generateNextLink(link) {
28+
return link.replace("<http", "http").replace(`>; rel="next"`, "");
29+
}
30+
2331
constructor(scriptState) {
2432
const { token, url, output, bar, observer } = scriptState;
2533
this.token = token;

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.2.1",
4+
"version": "1.4.0",
55
"main": "lib/index.js",
66
"license": "MIT",
77
"author": {

0 commit comments

Comments
 (0)