mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix: remove erroneous official pkg check
This causes an issue that should have been obvious from the get-go: if a package request is up in the AUR, but the package has already been picked up by an official repository, we would end up returning a 404 here, leading a TU to not be able to perform an action for a request's target. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
101de8e7b1
commit
c783ce17be
2 changed files with 0 additions and 22 deletions
|
@ -98,17 +98,10 @@ def get_pkg_or_base(
|
||||||
:raises HTTPException: With status code 404 if record doesn't exist
|
:raises HTTPException: With status code 404 if record doesn't exist
|
||||||
:return: {Package,PackageBase} instance
|
:return: {Package,PackageBase} instance
|
||||||
"""
|
"""
|
||||||
provider = db.query(models.OfficialProvider).filter(
|
|
||||||
models.OfficialProvider.Name == name).first()
|
|
||||||
if provider:
|
|
||||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
|
||||||
|
|
||||||
with db.begin():
|
with db.begin():
|
||||||
instance = db.query(cls).filter(cls.Name == name).first()
|
instance = db.query(cls).filter(cls.Name == name).first()
|
||||||
|
|
||||||
if not instance:
|
if not instance:
|
||||||
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
raise HTTPException(status_code=HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -203,21 +203,6 @@ def test_package_not_found(client: TestClient):
|
||||||
assert resp.status_code == int(HTTPStatus.NOT_FOUND)
|
assert resp.status_code == int(HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
|
|
||||||
def test_package_official_not_found(client: TestClient, package: Package):
|
|
||||||
""" When a Package has a matching OfficialProvider record, it is not
|
|
||||||
hosted on AUR, but in the official repositories. Getting a package
|
|
||||||
with this kind of record should return a status code 404. """
|
|
||||||
with db.begin():
|
|
||||||
db.create(OfficialProvider,
|
|
||||||
Name=package.Name,
|
|
||||||
Repo="core",
|
|
||||||
Provides=package.Name)
|
|
||||||
|
|
||||||
with client as request:
|
|
||||||
resp = request.get(package_endpoint(package))
|
|
||||||
assert resp.status_code == int(HTTPStatus.NOT_FOUND)
|
|
||||||
|
|
||||||
|
|
||||||
def test_package(client: TestClient, package: Package):
|
def test_package(client: TestClient, package: Package):
|
||||||
""" Test a single / packages / {name} route. """
|
""" Test a single / packages / {name} route. """
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue