#2214 api: cannot split repos when it is NULL
Merged 2 months ago by praiskup. Opened 2 months ago by msuchy.
copr/ msuchy/copr apitb  into  main

@@ -430,7 +430,8 @@ 

          """

          Return repos of this copr as a list of strings

          """

-         return self.repos.split()

+         result = self.repos or ""

+         return result.split()

  

      @property

      def active_chroots(self):

Adressing:

ERROR:coprs.error_handlers:Admin-only exception
Request: GET /api_3/project/list?limit=1000
User: msuchy
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/flask/app.py", line 1513, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib/python3.10/site-packages/flask/app.py", line 1499, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(req.view_args)
File "/usr/share/copr/coprs_frontend/coprs/views/apiv3_ns/init.py", line 71, in pagination_wrapper
return f(*args,
kwargs)
File "/usr/share/copr/coprs_frontend/coprs/views/apiv3_ns/init.py", line 58, in query_params_wrapper
return f(args, *kwargs)
File "/usr/share/copr/coprs_frontend/coprs/views/apiv3_ns/apiv3_projects.py", line 106, in get_project_list
projects = paginator.map(to_dict)
File "/usr/share/copr/coprs_frontend/coprs/views/apiv3_ns/init.py", line 157, in map
return [fun(x) for x in self.get()]
File "/usr/share/copr/coprs_frontend/coprs/views/apiv3_ns/init.py", line 157, in <listcomp>
return [fun(x) for x in self.get()]
File "/usr/share/copr/coprs_frontend/coprs/views/apiv3_ns/apiv3_projects.py", line 34, in to_dict
"additional_repos": copr.repos_list,
File "/usr/share/copr/coprs_frontend/coprs/models.py", line 433, in repos_list
return self.repos.split()
AttributeError: 'NoneType' object has no attribute 'split'

Build succeeded.

This happened on internal Copr. I already hotfixed it there.

Pull-Request has been merged by praiskup

2 months ago
Metadata