From 5ce88f219b7737a1c4838022dcbcbda7aab3ce3a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 07 2020 16:33:39 +0000 Subject: Append a '-' to the name provided when searching packages by their source name This way the LIKE query that is done will match - rather than all the packages starting with (which may results in foo1 being returned instead of foo). Fixes https://pagure.io/mdapi/issue/96 Signed-off-by: Pierre-Yves Chibon --- diff --git a/mdapi/__init__.py b/mdapi/__init__.py index ba0c131..3ac7ab7 100644 --- a/mdapi/__init__.py +++ b/mdapi/__init__.py @@ -90,7 +90,7 @@ async def _get_pkg(branch, name=None, action=None, srcname=None): pkg = [Packages(*item) for item in pkg] break elif srcname: - async with db.execute(GET_PACKAGE_BY_SRC, (srcname+'%',)) as cursor: + async with db.execute(GET_PACKAGE_BY_SRC, (srcname+'-%',)) as cursor: pkg = await cursor.fetchone() if pkg: pkg = Packages(*pkg)