@@ -56,17 +56,17 @@ public function execute(string|PackageIndexEntry $packageInformation, \DateTimeI
5656 return ;
5757 }
5858
59- $ githubUrl = \ str_replace ('.git ' , '' , $ version ['source ' ]['url ' ]);
60- $ githubUrl = \ str_replace ('https://github.com/ ' , 'https://raw.githubusercontent.com/ ' , $ githubUrl .'/refs/heads/main/ ' );
59+ $ githubUrl = str_replace ('.git ' , '' , $ version ['source ' ]['url ' ]);
60+ $ githubUrl = str_replace ('//refs ' , ' /refs ' , str_replace ( ' https://github.com/ ' , 'https://raw.githubusercontent.com/ ' , $ githubUrl .'/refs/heads/main/ ' ) );
6161 $ mainExtensionYmlUrl = $ githubUrl .'.shopware-extension.yml ' ;
6262
6363 $ pluginData = [
6464 'icon ' => $ version ['extra ' ]['plugin-icon ' ] ?? $ githubUrl . '/src/Resources/config/plugin.png ' ,
65- ...$ packageInformation ->additionalMetadataExists ? $ this ->fetchExtensionYmlData ($ mainExtensionYmlUrl , $ githubUrl ): [],
65+ ...$ packageInformation ->additionalMetadataExists ? $ this ->fetchExtensionYmlData ($ mainExtensionYmlUrl , $ githubUrl ) : [],
6666 'packageName ' => $ packageInformation ->packageName ,
6767 'manufacturer ' => implode (', ' , array_column ($ version ['authors ' ], 'name ' )),
6868 'manufacturerLink ' => array_values ($ version ['extra ' ]['manufacturerLink ' ] ?? ['https://github.com ' ])[0 ], // get first translation - TODO: fix
69- 'license ' => $ version ['license ' ][0 ],
69+ 'license ' => $ version ['license ' ][0 ] ?? ' UNKNOWN ' ,
7070 'link ' => $ repositoryUrl ,
7171 'availableVersion ' => $ version ['version ' ],
7272 ];
@@ -76,11 +76,15 @@ public function execute(string|PackageIndexEntry $packageInformation, \DateTimeI
7676 }
7777
7878 if (!isset ($ pluginData ['description ' ]['en-GB ' ])) {
79- $ pluginData ['description ' ]['en-GB ' ] = $ version ['extra ' ]['description ' ]['en-GB ' ] ?? $ packageInformation ->packageName ;
79+ $ pluginData ['description ' ]['en-GB ' ] = !empty ($ version ['extra ' ]['description ' ]['en-GB ' ])
80+ ? $ version ['extra ' ]['description ' ]['en-GB ' ]
81+ : $ packageInformation ->packageName ;
8082 }
8183
8284 if (!isset ($ pluginData ['description ' ]['de-DE ' ])) {
83- $ pluginData ['description ' ]['de-DE ' ] = $ version ['extra ' ]['description ' ]['de-DE ' ] ?? $ packageInformation ->packageName ;
85+ $ pluginData ['description ' ]['de-DE ' ] = !empty ($ version ['extra ' ]['description ' ]['de-DE ' ])
86+ ? $ version ['extra ' ]['description ' ]['de-DE ' ]
87+ : $ packageInformation ->packageName ;
8488 }
8589
8690 $ pluginData ['name ' ]['de-DE ' ] = $ version ['extra ' ]['label ' ]['de-DE ' ] ?? $ packageInformation ->packageName ;
@@ -125,14 +129,22 @@ private function fetchExtensionYmlData(string $mainExtensionYmlUrl, string $gith
125129 if (isset ($ extensionYmlData ['store ' ]['icon ' ])) {
126130 $ pluginData ['icon ' ] = $ githubUrl . '/ ' . $ extensionYmlData ['store ' ]['icon ' ];
127131 }
128- foreach ($ extensionYmlData ['store ' ]['images ' ] as $ images ) {
129- $ pluginData ['images ' ][] = $ githubUrl . '/ ' . $ images ['file ' ];
132+ if (isset ($ extensionYmlData ['store ' ]['images ' ])) {
133+ foreach ($ extensionYmlData ['store ' ]['images ' ] as $ images ) {
134+ $ pluginData ['images ' ][] = $ githubUrl . '/ ' . $ images ['file ' ];
135+ }
130136 }
131137 if (isset ($ extensionYmlData ['store ' ]['description ' ]['en ' ])) {
132- $ pluginData ['description ' ]['en-GB ' ] = $ extensionYmlData ['store ' ]['description ' ]['en ' ];
138+ $ pluginData ['description ' ]['en-GB ' ] = $ this ->processFileUrls (
139+ $ extensionYmlData ['store ' ]['description ' ]['en ' ],
140+ $ githubUrl
141+ );
133142 }
134143 if (isset ($ extensionYmlData ['store ' ]['description ' ]['de ' ])) {
135- $ pluginData ['description ' ]['de-DE ' ] = $ extensionYmlData ['store ' ]['description ' ]['de ' ];
144+ $ pluginData ['description ' ]['de-DE ' ] = $ this ->processFileUrls (
145+ $ extensionYmlData ['store ' ]['description ' ]['de ' ],
146+ $ githubUrl
147+ );
136148 }
137149
138150 // TODO Load from markdown files
@@ -143,6 +155,15 @@ private function fetchExtensionYmlData(string $mainExtensionYmlUrl, string $gith
143155 return $ pluginData ;
144156 }
145157
158+ private function processFileUrls (string $ data , string $ githubUrl ): string
159+ {
160+ if (str_starts_with ($ data , 'file: ' )) {
161+ return $ githubUrl . '/ ' . substr ($ data , 5 );
162+ }
163+
164+ return $ data ;
165+ }
166+
146167 private function findSuitableVersion (array $ packagistData ): ?array
147168 {
148169 $ versions = $ packagistData ['package ' ]['versions ' ];
0 commit comments