chore: tidying up the fetchContents types
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -50,15 +50,6 @@ describe('fetchContent helper', () => {
|
||||
outputPath: os.tmpdir(),
|
||||
};
|
||||
|
||||
it('should reject non string fetchUrls', async () => {
|
||||
await expect(
|
||||
fetchContents({
|
||||
...options,
|
||||
fetchUrl: false,
|
||||
}),
|
||||
).rejects.toThrow('Invalid url parameter, expected string, got boolean');
|
||||
});
|
||||
|
||||
it('should reject absolute file locations', async () => {
|
||||
await expect(
|
||||
fetchContents({
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
import { resolveSafeChildPath, UrlReader } from '@backstage/backend-common';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
import { InputError } from '@backstage/errors';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import fs from 'fs-extra';
|
||||
@@ -31,15 +30,9 @@ export async function fetchContents({
|
||||
reader: UrlReader;
|
||||
integrations: ScmIntegrations;
|
||||
baseUrl?: string;
|
||||
fetchUrl?: JsonValue;
|
||||
fetchUrl?: string;
|
||||
outputPath: string;
|
||||
}) {
|
||||
if (typeof fetchUrl !== 'string') {
|
||||
throw new InputError(
|
||||
`Invalid url parameter, expected string, got ${typeof fetchUrl}`,
|
||||
);
|
||||
}
|
||||
|
||||
let fetchUrlIsAbsolute = false;
|
||||
try {
|
||||
// eslint-disable-next-line no-new
|
||||
|
||||
Reference in New Issue
Block a user