Merge commit from fork

This commit is contained in:
Ben Lambert
2026-01-20 16:05:28 +01:00
committed by GitHub
parent ae4dd5d157
commit c641c147ab
12 changed files with 238 additions and 11 deletions
@@ -86,6 +86,7 @@ describe('fetchContents helper', () => {
expect(fs.copy).toHaveBeenCalledWith(
resolvePath('/some/foo'),
'somepath',
expect.objectContaining({ filter: expect.any(Function) }),
);
});
+5 -2
View File
@@ -15,7 +15,10 @@
*/
import { UrlReaderService } from '@backstage/backend-plugin-api';
import { resolveSafeChildPath } from '@backstage/backend-plugin-api';
import {
isChildPath,
resolveSafeChildPath,
} from '@backstage/backend-plugin-api';
import { InputError } from '@backstage/errors';
import { ScmIntegrations } from '@backstage/integration';
import fs from 'fs-extra';
@@ -50,7 +53,7 @@ export async function fetchContents(options: {
if (!fetchUrlIsAbsolute && baseUrl?.startsWith('file://')) {
const basePath = baseUrl.slice('file://'.length);
const srcDir = resolveSafeChildPath(path.dirname(basePath), fetchUrl);
await fs.copy(srcDir, outputPath);
await fs.copy(srcDir, outputPath, { filter: src => isChildPath(srcDir, src) });
} else {
const readUrl = getReadUrl(fetchUrl, baseUrl, integrations);