#3913 empty milestones make filing new issue crash
Closed: Fixed Opened by kevin.

Seen on pagure.io:

[Fri Oct 12 18:44:51.794772 2018] [:error] [pid 6910] [remote 152.19.134.147:4] mod_wsgi (pid=6910): Exception occurred processing WSGI script '/var/www/pagure.wsgi'.
[Fri Oct 12 18:44:51.794964 2018] [:error] [pid 6910] [remote 152.19.134.147:4] Traceback (most recent call last):
[Fri Oct 12 18:44:51.795081 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__
[Fri Oct 12 18:44:51.795270 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     return self.wsgi_app(environ, start_response)
[Fri Oct 12 18:44:51.795358 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/pagure/proxy.py", line 74, in __call__
[Fri Oct 12 18:44:51.795644 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     return self.app(environ, start_response)
[Fri Oct 12 18:44:51.795752 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app
[Fri Oct 12 18:44:51.795906 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     response = self.make_response(self.handle_exception(e))
[Fri Oct 12 18:44:51.796094 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception
[Fri Oct 12 18:44:51.796259 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     reraise(exc_type, exc_value, tb)
[Fri Oct 12 18:44:51.796378 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
[Fri Oct 12 18:44:51.796618 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     response = self.full_dispatch_request()
[Fri Oct 12 18:44:51.796765 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
[Fri Oct 12 18:44:51.796930 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     rv = self.handle_user_exception(e)
[Fri Oct 12 18:44:51.797052 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
[Fri Oct 12 18:44:51.797257 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     reraise(exc_type, exc_value, tb)
[Fri Oct 12 18:44:51.797375 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
[Fri Oct 12 18:44:51.797687 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     rv = self.dispatch_request()
[Fri Oct 12 18:44:51.797808 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
[Fri Oct 12 18:44:51.797938 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     return self.view_functions[rule.endpoint](**req.view_args)
[Fri Oct 12 18:44:51.798019 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/pagure/utils.py", line 244, in decorated_function
[Fri Oct 12 18:44:51.798115 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     return function(*args, **kwargs)
[Fri Oct 12 18:44:51.798183 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/pagure/decorators.py", line 35, in check_issue_tracker
[Fri Oct 12 18:44:51.798281 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     return function(*args, **kwargs)
[Fri Oct 12 18:44:51.798346 2018] [:error] [pid 6910] [remote 152.19.134.147:4]   File "/usr/lib/python2.7/site-packages/pagure/ui/issues.py", line 877, in new_issue
[Fri Oct 12 18:44:51.798518 2018] [:error] [pid 6910] [remote 152.19.134.147:4]     if repo.milestones[m]["active"]:
[Fri Oct 12 18:44:51.798691 2018] [:error] [pid 6910] [remote 152.19.134.147:4] KeyError: u''

The project had 2 milestones, but they were both '' (ie, blank) and inactive. Adding 'a' and 'b' to them worked around the issue.

Would be good to ignore milestones that aren't set, or have a way to delete them.


How did you create a milestone with name ''?
Ideally, any milestone with a blank name should be ignored.

How did you create a milestone with name ''?
Ideally, any milestone with a blank name should be ignored.

It should not be possible any longer but existing projects may have existing milestones that are ''.

I thought I had fixed that though, guess not, or not everywhere :)

Metadata Update from @pingou:
- Issue set to the milestone: 5.2
- Issue tagged with: bug, easyfix

I did fix this before (cf 14832556b67ef9ac6cad389d6b138ef22b194e06 ), just not in all places indeed :)

Metadata Update from @pingou:
- Issue assigned to pingou

Commit 44e948db fixes this issue

Metadata