Skip to content

Commit 42e4012

Browse files
committed
...
1 parent c0f1582 commit 42e4012

File tree

1 file changed

+19
-24
lines changed

1 file changed

+19
-24
lines changed

index.js

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -510,41 +510,36 @@ function main() {
510510
try {
511511
const all = await getConanBinaries(req.params.library, req.params.library_version);
512512
const compiler = all.perCompiler[req.params.compiler_version];
513-
const combinationIdx = all.possibleCombinations.findIndex((combo) =>
514-
combo.arch === req.params.arch.trim() &&
515-
combo['compiler.libcxx'] === req.params.libcxx.trim());
513+
const combinationIdxes = [];
514+
for (let idx = 0; idx < all.possibleCombinations.length; idx++) {
515+
const combo = all.possibleCombinations[idx];
516+
if (combo.arch === req.params.arch.trim() &&
517+
combo['compiler.libcxx'] === req.params.libcxx.trim()) {
518+
combinationIdxes.push(idx);
519+
}
520+
}
516521

517-
if (combinationIdx !== -1 && compiler) {
522+
if (combinationIdxes.length > 0 && compiler) {
518523
if (is_restricted_compiler(req.params.compiler_version, compiler.compilertype)) {
519524
res.sendStatus(403);
520525
return;
521526
}
522527

523-
const hashIdx = compiler.combinations.indexOf(combinationIdx);
524-
if (hashIdx !== -1) {
525-
const hash = compiler.hashes[hashIdx];
526-
const url = await getPackageUrl(req.params.library, req.params.library_version, hash);
527-
if (url && url['conan_package.tgz']) {
528-
found = true;
529-
res.redirect(302, url['conan_package.tgz']);
528+
for (let combinationIdx of combinationIdxes) {
529+
const hashIdx = compiler.combinations.indexOf(combinationIdx);
530+
if (hashIdx !== -1) {
531+
const hash = compiler.hashes[hashIdx];
532+
const url = await getPackageUrl(req.params.library, req.params.library_version, hash);
533+
if (url && url['conan_package.tgz']) {
534+
found = true;
535+
res.redirect(302, url['conan_package.tgz']);
536+
}
530537
}
531538
}
532539
}
533540

534-
// {"library":"zlib","library_version":"1.3.1","compiler_version":"clang_bb_p2996","arch":"x86_64","libcxx":"libc++"}
535-
// [{"arch":"x86","build_type":"Debug","compiler.libcxx":"libstdc++","flagcollection":"","os":"Linux","stdver":""},
536-
// {"arch":"","build_type":"Debug","compiler.libcxx":"libstdc++","flagcollection":"","os":"Linux","stdver":""},
537-
// {"arch":"x86_64","build_type":"Debug","compiler.libcxx":"libstdc++","flagcollection":"","os":"Linux","stdver":""},
538-
// {"arch":"x86","build_type":"Debug","compiler.libcxx":"libc++","flagcollection":"","os":"Linux","stdver":""},
539-
// {"arch":"x86_64","build_type":"Debug","compiler.libcxx":"libc++","flagcollection":"","os":"Linux","stdver":""},
540-
// {"arch":"","build_type":"Debug","compiler.libcxx":"libc++","flagcollection":"","os":"Linux","stdver":""},
541-
// {"arch":"x86_64","build_type":"Debug","compiler.libcxx":"libc++","flagcollection":"","os":"Linux","stdver":"c++2a"},
542-
// {"arch":"x86_64","build_type":"Debug","compiler.libcxx":"libc++","flagcollection":"","os":"Linux","stdver":"c++2c"},
543-
// {"arch":"x86_64","build_type":"Debug","compiler.libcxx":"libstdc++","flagcollection":"","os":"Linux","stdver":"c++20"},
544-
// {"arch":"x86_64","build_type":"Debug","compiler.libcxx":"libc++","flagcollection":"","os":"Linux","stdver":"c++20"},
545-
// {"arch":"x86_64","build_type":"Debug","compiler.libcxx":"libc++","flagcollection":"","os":"Linux","stdver":"c++26"}]
546541
if (!found)
547-
res.send(all.perCompiler);
542+
res.send(404);
548543
} catch (e) {
549544
console.error(e);
550545
res.send(e);

0 commit comments

Comments
 (0)