]> git.ipfire.org Git - pbs.git/commitdiff
hub: Fix uploading builds without chosen repository
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 7 Mar 2023 17:36:38 +0000 (17:36 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 7 Mar 2023 17:36:38 +0000 (17:36 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hub/builds.py

index 9806ec5bab5d5c5129906e3bf6074cb936d3c416..bad0d4bf6a40adceed43332e475c00108d7cae6c 100644 (file)
@@ -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)