fix: trim '/' from folder (#3052)

This commit is contained in:
Erez Rokah 2020-01-08 19:02:44 +02:00 committed by GitHub
parent 90521ba82e
commit 4b6c8de6b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import { Base64 } from 'js-base64';
import semaphore, { Semaphore } from 'semaphore';
import { flow, get, initial, last, partial, result, differenceBy, trimStart } from 'lodash';
import { flow, get, initial, last, partial, result, differenceBy, trimStart, trim } from 'lodash';
import { map, filter } from 'lodash/fp';
import {
getAllResponses,
@ -511,7 +511,7 @@ export default class API {
}
async listFiles(path: string, { repoURL = this.repoURL, branch = this.branch, depth = 1 } = {}) {
const folder = trimStart(path, '/');
const folder = trim(path, '/');
return this.request(`${repoURL}/git/trees/${branch}:${folder}`, {
// GitHub API supports recursive=1 for getting the entire recursive tree
// or omitting it to get the non-recursive tree