From 42a751ad87bebe3c297038104f38856cd9d2c16f Mon Sep 17 00:00:00 2001 From: David McFarland Date: Mon, 10 Mar 2025 19:54:26 -0300 Subject: [PATCH] nuget-to-json: fix missing tool packages After dotnet 9.0.1->9.0.2, when a package is restored with 'tool install', .nupkg.metadata no longer contains the field: "source": null It still contains "contentHash", so we return a dummy source name in that case. Fixes: 383ceb66d1f04b5f6820fe1bff32db1c2058381f --- pkgs/by-name/nu/nuget-to-json/nuget-to-json.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/nu/nuget-to-json/nuget-to-json.sh b/pkgs/by-name/nu/nuget-to-json/nuget-to-json.sh index b2b051398b25..3df04c06aff8 100755 --- a/pkgs/by-name/nu/nuget-to-json/nuget-to-json.sh +++ b/pkgs/by-name/nu/nuget-to-json/nuget-to-json.sh @@ -62,7 +62,8 @@ done fi # packages in the nix store should have an empty metadata file - used_source="$(jq -r 'if has("source") then .source else "" end' "$version"/.nupkg.metadata)" + # packages installed with 'dotnet tool' may be missing 'source' + used_source="$(jq -r 'if has("source") then .source elif has("contentHash") then "__unknown" else "" end' "$version"/.nupkg.metadata)" found=false if [[ -z "$used_source" || -d "$used_source" ]]; then