Skip to content

Commit 1aa3c38

Browse files
committed
Only fetch libraries libraries from library manager if they don't exist in personal libs array.
1 parent cd61dd5 commit 1aa3c38

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Symfony/src/Codebender/ApiBundle/Controller/DefaultController.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,18 @@ protected function checkHeaders($files, array $personalLibs)
121121
// get library manager url
122122
$libmanager_url = $this->container->getParameter('library');
123123

124+
// TODO: improve this.
125+
$personal_lib_keys = array_keys($personalLibs);
126+
$foundPersonal = false;
124127
$libraries = $personalLibs;
125128
foreach ($headers as $header) {
126-
if (!in_array($header, $personalLibs)) {
129+
$foundPersonal = false;
130+
foreach ($personal_lib_keys as $key){
131+
if (strpos($key, "cb_personal_lib_".$header) !== false){
132+
$foundPersonal = true;
133+
}
134+
}
135+
if ($foundPersonal === false) {
127136

128137
$data = $apiHandler->get($libmanager_url . "/fetch?library=" . urlencode($header));
129138
$data = json_decode($data, true);

0 commit comments

Comments
 (0)