Merge pull request #7114 from backstage/revert-7086-blam/root-fodlers

Revert "fix `subpath` filtering for `AzureDevOps` `readTree`"
This commit is contained in:
Patrik Oldsberg
2021-09-09 12:22:46 +02:00
committed by GitHub
3 changed files with 2 additions and 23 deletions
-5
View File
@@ -1,5 +0,0 @@
---
'@backstage/backend-common': patch
---
Fixing issue with `AzureUrlReader` that doesn't do `subpath` directories correctly
@@ -220,21 +220,6 @@ describe('AzureUrlReader', () => {
expect(indexMarkdownFile.toString()).toBe('# Test\n');
});
it('returns the wanted files from an archive when a subpath is passed through', async () => {
const response = await processor.readTree(
'https://dev.azure.com/organization/project/_git/repository?path=%2Fdocs',
);
expect(response.etag).toBe('123abc2');
const files = await response.files();
expect(files.length).toBe(1);
const indexMarkdownFile = await files[0].content();
expect(indexMarkdownFile.toString()).toBe('# Test\n');
});
it('creates a directory with the wanted files', async () => {
const response = await processor.readTree(
'https://dev.azure.com/organization/project/_git/repository',
@@ -94,6 +94,8 @@ export class AzureUrlReader implements UrlReader {
url: string,
options?: ReadTreeOptions,
): Promise<ReadTreeResponse> {
// TODO: Support filepath based reading tree feature like other providers
// Get latest commit SHA
const commitsAzureResponse = await fetch(
@@ -127,13 +129,10 @@ export class AzureUrlReader implements UrlReader {
throw new Error(message);
}
const { filepath } = parseGitUrl(url);
return await this.deps.treeResponseFactory.fromZipArchive({
stream: archiveAzureResponse.body as unknown as Readable,
etag: commitSha,
filter: options?.filter,
subpath: filepath,
});
}