From ae29b4b2060af6ee75417d37c0a4788655b78d88 Mon Sep 17 00:00:00 2001
From: Neil Drumm <drumm@delocalizedham.com>
Date: Tue, 26 Sep 2023 17:24:48 -0400
Subject: [PATCH] Issue #3309665: Do not promote component name to project name
 when getting namespace of package

---
 project_composer.module | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/project_composer.module b/project_composer.module
index 68bea85..14dd5f3 100644
--- a/project_composer.module
+++ b/project_composer.module
@@ -1683,16 +1683,18 @@ function _project_composer_delete_providers($release_category, $project_nid, $pr
  * @param $project_name
  * @param $component_name
  * @param null $project_nid
+ *   Omit for resolving a dependency.
  *
  * @return mixed
  */
 function _project_composer_get_packagename($release_category, $project_name, $component_name = NULL, $project_nid = NULL) {
-  // package name for drupal dependencies is always drupal, or core. And we do not want to save anything for
-  // core dependencies to the namespace map.
+  // Package name for Drupal dependencies is always 'drupal', or core. And we
+  // do not want to save anything for core dependencies to the namespace map.
 
-  // Some core modules have been removed, so dependencies on 'drupal:removed_module' should now resolve to the project instead of drupal/core
-  $removed_core_modules = _project_composer_get_removed_components($release_category);
-  if (in_array($component_name,$removed_core_modules)) {
+  // Some core modules have been removed, so dependencies on
+  // 'drupal:removed_module' should now resolve to the project instead of
+  // 'drupal/core'
+  if (is_null($project_nid) && in_array($component_name, _project_composer_get_removed_components($release_category))) {
     $project_name = $component_name;
   }
 
-- 
GitLab