From 3991e883d17977a655383c4e353e971d49a10149 Mon Sep 17 00:00:00 2001 From: "Alexis (Poliorcetics) Bourget" Date: Mon, 10 Oct 2022 16:02:49 +0200 Subject: [PATCH] fix: correctly find workspace.dependencies-declared dependencies and their Cargo.toml --- cargo/lib/dependabot/cargo/file_fetcher.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cargo/lib/dependabot/cargo/file_fetcher.rb b/cargo/lib/dependabot/cargo/file_fetcher.rb index c42ff51884d..d2f8dddea6f 100644 --- a/cargo/lib/dependabot/cargo/file_fetcher.rb +++ b/cargo/lib/dependabot/cargo/file_fetcher.rb @@ -264,6 +264,16 @@ def required_path?(file, path) end end + # Paths specified for workspace-wide dependencies + workspace = parsed_file(file).fetch("workspace", {}) + workspace.fetch("dependencies", {}).each do |_, details| + next unless details.is_a?(Hash) + next unless details["path"] + next unless path == File.join(details["path"], "Cargo.toml") + + return true if details["git"].nil? + end + # Paths specified as replacements parsed_file(file).fetch("replace", {}).each do |_, details| next unless details.is_a?(Hash)