Download tar.gz archives for Bitbucket

Signed-off-by: Mathias Åhsberg <mathias.ahsberg@resurs.se>
This commit is contained in:
Mathias Åhsberg
2021-06-04 12:46:42 +00:00
parent 18ddc1b318
commit eda9dbd5fa
9 changed files with 27 additions and 21 deletions
@@ -135,7 +135,7 @@ describe('bitbucket core', () => {
config,
);
expect(result).toEqual(
'https://api.bitbucket.mycompany.net/rest/api/1.0/projects/backstage/repos/mock/archive?format=zip&at=main&prefix=backstage-mock&path=docs',
'https://api.bitbucket.mycompany.net/rest/api/1.0/projects/backstage/repos/mock/archive?format=tgz&at=main&prefix=backstage-mock&path=docs',
);
});
@@ -164,7 +164,7 @@ describe('bitbucket core', () => {
);
expect(result).toEqual(
'https://api.bitbucket.mycompany.net/rest/api/1.0/projects/backstage/repos/mock/archive?format=zip&at=main&prefix=backstage-mock',
'https://api.bitbucket.mycompany.net/rest/api/1.0/projects/backstage/repos/mock/archive?format=tgz&at=main&prefix=backstage-mock',
);
});
@@ -178,7 +178,7 @@ describe('bitbucket core', () => {
config,
);
expect(result).toEqual(
'https://api.bitbucket.mycompany.net/rest/api/1.0/projects/backstage/repos/mock/archive?format=zip&at=some-branch&prefix=backstage-mock&path=docs',
'https://api.bitbucket.mycompany.net/rest/api/1.0/projects/backstage/repos/mock/archive?format=tgz&at=some-branch&prefix=backstage-mock&path=docs',
);
});
@@ -192,7 +192,7 @@ describe('bitbucket core', () => {
config,
);
expect(result).toEqual(
'https://bitbucket.org/backstage/mock/get/master.zip',
'https://bitbucket.org/backstage/mock/get/master.tgz',
);
});
});
+2 -2
View File
@@ -98,8 +98,8 @@ export async function getBitbucketDownloadUrl(
// /docs/index.md will download the docs folder and everything below it
const path = filepath ? `&path=${encodeURIComponent(filepath)}` : '';
const archiveUrl = isHosted
? `${protocol}://${resource}/${project}/${repoName}/get/${branch}.zip`
: `${config.apiBaseUrl}/projects/${project}/repos/${repoName}/archive?format=zip&at=${branch}&prefix=${project}-${repoName}${path}`;
? `${protocol}://${resource}/${project}/${repoName}/get/${branch}.tgz`
: `${config.apiBaseUrl}/projects/${project}/repos/${repoName}/archive?format=tgz&at=${branch}&prefix=${project}-${repoName}${path}`;
return archiveUrl;
}