From 3d90b6d9910e4d24c09c178b4e34338decd520a5 Mon Sep 17 00:00:00 2001
From: Fran Garcia-Linares <14157-fjgarlin@users.noreply.drupalcode.org>
Date: Tue, 26 Nov 2024 09:48:39 +0000
Subject: [PATCH 1/2] Adapt files path.

---
 src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php b/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php
index bb56dd95a..1bba09d64 100644
--- a/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php
+++ b/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php
@@ -327,9 +327,12 @@ class DrupalDotOrgJsonApi extends ProjectBrowserSourceBase {
         if (!empty($project_images)) {
           $images = [];
           foreach ($project_images as $image) {
+            $uri = self::DRUPAL_ORG_ENDPOINT . $related[$image['type']][$image['id']]['uri']['url'];
+            // When querying via www.drupal.org domain, the files path needs to be adapted.
+            $uri = str_replace(self::DRUPAL_ORG_ENDPOINT . '/assets/', self::DRUPAL_ORG_ENDPOINT . '/files/', $uri);
             $images[] = [
               'file' => [
-                'uri' => self::DRUPAL_ORG_ENDPOINT . $related[$image['type']][$image['id']]['uri']['url'],
+                'uri' => $uri,
                 'resource' => 'image',
               ],
               'alt' => $image['meta']['alt'] ?? '',
-- 
GitLab


From 5399279c5db3bb81ca195859ba7f272bea55489b Mon Sep 17 00:00:00 2001
From: Fran Garcia-Linares <14157-fjgarlin@users.noreply.drupalcode.org>
Date: Tue, 26 Nov 2024 10:45:50 +0000
Subject: [PATCH 2/2] Apply 1 suggestion(s) to 1 file(s)

---
 src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php b/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php
index 1bba09d64..8b4ce57b1 100644
--- a/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php
+++ b/src/Plugin/ProjectBrowserSource/DrupalDotOrgJsonApi.php
@@ -328,7 +328,7 @@ class DrupalDotOrgJsonApi extends ProjectBrowserSourceBase {
           $images = [];
           foreach ($project_images as $image) {
             $uri = self::DRUPAL_ORG_ENDPOINT . $related[$image['type']][$image['id']]['uri']['url'];
-            // When querying via www.drupal.org domain, the files path needs to be adapted.
+            // Adapt the path as we are querying via www.drupal.org.
             $uri = str_replace(self::DRUPAL_ORG_ENDPOINT . '/assets/', self::DRUPAL_ORG_ENDPOINT . '/files/', $uri);
             $images[] = [
               'file' => [
-- 
GitLab