From: Michael Tremer Date: Tue, 7 Mar 2023 17:36:38 +0000 (+0000) Subject: hub: Fix uploading builds without chosen repository X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e44cc4ee3d79de73f1eb5c76c3ae09a3680642a2;p=pbs.git hub: Fix uploading builds without chosen repository Signed-off-by: Michael Tremer --- diff --git a/src/hub/builds.py b/src/hub/builds.py index 9806ec5b..bad0d4bf 100644 --- a/src/hub/builds.py +++ b/src/hub/builds.py @@ -37,7 +37,7 @@ class CreateHandler(BaseHandler): raise tornado.web.HTTPError(403, "No permission for using upload %s" % upload) # Fetch the repository - repo_name = self.get_argument("repo") + repo_name = self.get_argument("repo", None) with self.db.transaction(): # Import the package @@ -45,15 +45,14 @@ class CreateHandler(BaseHandler): package = await self.backend.packages.create(upload) # If the distribution that is coded into the package could not be found, - # we will send that error to the user + # we will send that error to the user... except NoSuchDistroError as e: - # XXX probably send something better than this raise tornado.web.HTTPError(404, "Could not find distribution: %s" % e) # Find the repository repo = self.current_user.get_repo(package.distro, repo_name) if not repo: - raise tornado.web.HTTPError(404, "Could not find repository: %s" % repo_name) + raise tornado.web.HTTPError(404, "Could not find repository") # Create a new build build = self.backend.builds.create(repo, package, owner=self.user)