Skip to content

Commit

Permalink
fix(manager/nuget): skip invalid xml files (#16758)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceice committed Jul 25, 2022
1 parent 2bbbc95 commit 17387fc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions lib/modules/manager/nuget/package-tree.spec.ts
Expand Up @@ -155,12 +155,10 @@ describe('modules/manager/nuget/package-tree', () => {
);
});

it('throws error on invalid xml file', async () => {
it('skips on invalid xml file', async () => {
git.getFileList.mockResolvedValue(['foo/bar.csproj']);
Fixtures.mock({ '/tmp/repo/foo/bar.csproj': '<invalid' });
await expect(getDependentPackageFiles('foo/bar.csproj')).rejects.toThrow(
'Invalid xml file: foo/bar.csproj'
);
expect(await getDependentPackageFiles('foo/bar.csproj')).toEqual([]);
});
});
});
2 changes: 1 addition & 1 deletion lib/modules/manager/nuget/package-tree.ts
Expand Up @@ -40,7 +40,7 @@ export async function getDependentPackageFiles(
for (const f of packageFiles) {
const doc = await readFileAsXmlDocument(f);
if (!doc) {
throw new Error(`Invalid xml file: ${f}`);
continue;
}

const projectReferenceAttributes = doc
Expand Down

0 comments on commit 17387fc

Please sign in to comment.