#62 Bad error message when importing BZ info
Opened 4 years ago by churchyard. Modified 4 years ago

Consider the following summary of a review request:

Container Review Request - python-classroom - Container for teaching and learning Python

Note that it has no :, but it has 2 '-'.

The code in pkgdb2/api/extras.py api_pkgrequest() does the following:

    tmp = bug.summary.partition(':')[2]
    if not tmp:
        httpcode = 400
        output['output'] = 'notok'
        output['error'] = 'Invalid title for this bugzilla ticket (no ":" '\
            'present)'

    # Check the format of the title
    if not ' - ' in tmp:
        httpcode = 400
        output['output'] = 'notok'
        output['error'] = 'Invalid title for this bugzilla ticket (no "-" '\
            'present)'

In our case tmp gets set to an empty string '' and the first if will happen setting the error message to the correct thing ('Invalid title for this bugzilla ticket (no ":" present)').

However, the second if will happen as well changing the error message to incorrect '...(no "-" present)'.

The second if has to be guarded (it has to check if tmp is True as well). Will send a PR.


Login to comment on this ticket.

Metadata