fix(git-gateway-gitlab): fix large media support for editorial workflow (#3105)

This commit is contained in:
Erez Rokah
2020-01-19 14:25:29 +02:00
committed by GitHub
parent 07fa5b316c
commit 038803c9f2
13 changed files with 7147 additions and 12 deletions

View File

@ -279,7 +279,10 @@ export default class GitGateway implements Implementation {
files.map(async file => {
if (client.matchPath(file.path)) {
const { id, path } = file;
const largeMediaDisplayURLs = await this.getLargeMediaDisplayURLs([{ ...file, id }]);
const largeMediaDisplayURLs = await this.getLargeMediaDisplayURLs(
[{ ...file, id }],
branch,
);
const url = await client.getDownloadURL(largeMediaDisplayURLs[id]);
return {
id,
@ -379,13 +382,18 @@ export default class GitGateway implements Implementation {
},
);
}
async getLargeMediaDisplayURLs(mediaFiles: { path: string; id: string | null }[]) {
async getLargeMediaDisplayURLs(
mediaFiles: { path: string; id: string | null }[],
branch = this.branch,
) {
const client = await this.getLargeMediaClient();
const filesPromise = entriesByFiles(
mediaFiles,
this.api!.readFile.bind(this.api!),
'Git-Gateway',
);
const readFile = (
path: string,
id: string | null | undefined,
{ parseText }: { parseText: boolean },
) => this.api!.readFile(path, id, { branch, parseText });
const filesPromise = entriesByFiles(mediaFiles, readFile, 'Git-Gateway');
return filesPromise
.then(items =>