diff --git a/package.json b/package.json index ce9460f..864065c 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/website/app.ts b/src/website/app.ts index cda27cc..4212e9c 100644 --- a/src/website/app.ts +++ b/src/website/app.ts @@ -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"; @@ -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]);