Skip to content

Commit

Permalink
Fix search when fetching qualified refs.
Browse files Browse the repository at this point in the history
In the case the conan client queries a package that has a version range
it will ask for all of the packages for any version. That would fail as we
would not account for it including the identity. This adjusts the query
to allow for the identity.
  • Loading branch information
grafikrobot committed Oct 19, 2022
1 parent f973542 commit 29fb410
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "barbarian",
"version": "0.3.0",
"version": "0.3.1",
"description": "Barbarian is a Conan meta-server serving package recipes directly from GitHub repositories.",
"main": "barbarian.bfgroup.xyz/app.js",
"scripts": {
Expand Down
8 changes: 7 additions & 1 deletion src/website/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ async function epv2_search(req: Request, res: Response) {
query = query?.replace(/_/g, '\\_');
query = query?.replace(/%/g, '\\%');
query = query?.replace(/[*]/g, '%');
// We need to match the full reference. Which includes the rev hash.
// But if the query is already looking for a rev hash match we don't
// need to match for it.
if (!query?.includes("#")) {
query = query?.concat("#%");
}
var binary = "";
if (('ignorecase' in req.query) && req.query.ignorecase == "False") {
binary = "BINARY";
Expand All @@ -223,7 +229,7 @@ async function epv2_search(req: Request, res: Response) {
+ " CONCAT(name, '/', version, '@', identity) as ref"
+ " FROM barbarian_package"
+ " WHERE packager = 'conan'"
+ " AND CONCAT(name,'/',version) LIKE " + binary + " ?"
+ " AND CONCAT(name, '/', version, '@', identity) LIKE " + binary + " ?"
+ " ORDER BY name"
+ " LIMIT 100",
[query]);
Expand Down

0 comments on commit 29fb410

Please sign in to comment.