fix(backend-github): loaded entries limit (#2873)

* fix(backend-github): loaded entries limit

* test(cypress): update recorded data
This commit is contained in:
Bartholomew
2019-11-13 10:02:47 +01:00
committed by Erez Rokah
parent f3eaaa6432
commit 68a8c8a693
25 changed files with 11220 additions and 10376 deletions

View File

@ -331,16 +331,16 @@ export default class API {
}
listFiles(path, { repoURL = this.repoURL, branch = this.branch } = {}) {
return this.request(`${repoURL}/contents/${path.replace(/\/$/, '')}`, {
params: { ref: branch },
})
.then(files => {
if (!Array.isArray(files)) {
throw new Error(`Cannot list files, path ${path} is not a directory but a ${files.type}`);
}
return files;
})
.then(files => files.filter(file => file.type === 'file'));
const folderPath = path.replace(/\/$/, '');
return this.request(`${repoURL}/git/trees/${branch}:${folderPath}`).then(res =>
res.tree
.filter(file => file.type === 'blob')
.map(file => ({
...file,
name: file.path,
path: `${folderPath}/${file.path}`,
})),
);
}
readUnpublishedBranchFile(contentKey) {