From c8dc59cdf213553080d114589a2ad281e3d348be Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 16 May 2021 23:59:47 +0000 Subject: [PATCH] fix(core): update --- package.json | 2 +- readme.md | 1 - ts/gitlab.classes.account.ts | 10 +++++++--- ts/gitlab.classes.project.ts | 22 ++++++++++++++++------ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 7e2bb25..2f92c9c 100644 --- a/package.json +++ b/package.json @@ -39,4 +39,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/readme.md b/readme.md index 55e1023..40e98ad 100644 --- a/readme.md +++ b/readme.md @@ -34,7 +34,6 @@ For further information read the linked docs at the top of this README. [![repo-footer](https://mojoio.gitlab.io/assets/repo-footer.svg)](https://mojo.io) - ## Contribution We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) diff --git a/ts/gitlab.classes.account.ts b/ts/gitlab.classes.account.ts index 3a78b65..ffc5f5f 100644 --- a/ts/gitlab.classes.account.ts +++ b/ts/gitlab.classes.account.ts @@ -46,12 +46,16 @@ export class GitlabAccount { for (const link of links) { linkObjects.push({ original: link, - link: findLinkName(link) + link: findLinkName(link), }); } - const next = linkObjects.find(linkObject => linkObject.original.includes('rel="next"')); + const next = linkObjects.find((linkObject) => linkObject.original.includes('rel="next"')); if (next && response.body instanceof Array) { - const nextResponse = await this.request(methodArg, next.link.replace('https://gitlab.com/api/v4', ''), {}); + const nextResponse = await this.request( + methodArg, + next.link.replace('https://gitlab.com/api/v4', ''), + {} + ); response.body = response.body.concat(nextResponse); } } diff --git a/ts/gitlab.classes.project.ts b/ts/gitlab.classes.project.ts index 6420490..d8e327e 100644 --- a/ts/gitlab.classes.project.ts +++ b/ts/gitlab.classes.project.ts @@ -111,7 +111,7 @@ export class GitlabProject { per_page: '100', } ); - const allProjects: GitlabProject[] = [] + const allProjects: GitlabProject[] = []; for (const projectData of response) { allProjects.push(new GitlabProject(projectData, gitlabGroupArg)); } @@ -127,11 +127,21 @@ export class GitlabProject { this.gitlabGroupRef = gitlabGroupRefArg; } - public async getFileFromProject(filePathArg: string, refArg: string): Promise { - const response = await this.gitlabGroupRef.gitlabAccountRef.request('GET', `/projects/${this.data.id}/repository/files/${filePathArg}`, { - ref: refArg - }); - return plugins.smartfile.Smartfile.fromBuffer(filePathArg, Buffer.from(response.content, response.encoding)); + public async getFileFromProject( + filePathArg: string, + refArg: string + ): Promise { + const response = await this.gitlabGroupRef.gitlabAccountRef.request( + 'GET', + `/projects/${this.data.id}/repository/files/${filePathArg}`, + { + ref: refArg, + } + ); + return plugins.smartfile.Smartfile.fromBuffer( + filePathArg, + Buffer.from(response.content, response.encoding) + ); } public async getReadmeAsMarkdown(refArg: string = 'master'): Promise {