chore: tidying up the fetchContents types

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-02-18 16:17:23 +01:00
parent 253bd2081c
commit e21755c639
2 changed files with 1 additions and 17 deletions
@@ -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