addAttachment() with empty data crashes with HTTP Error 400: Bad Request
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
launchpadlib |
Invalid
|
Undecided
|
Unassigned |
Bug Description
The apport retracer just crashed with
Traceback (most recent call last):
File "/tmp/tmpwVg4WG
crashdb.
File "/usr/lib/
is_patch=False)
File "/usr/lib/
url, in_representation, http_method, extra_headers=
File "/usr/lib/
raise HTTPError(response, content)
launchpadlib.
when it tried to do this:
(For my own record and reproduction: this happens on 353707).
What condition causes this error? I've seen it work fine on other bugs, so I don't think there's something generally wrong with the code.
summary: |
- addAttachment() crashes with HTTP Error 400: Bad Request for empty files + addAttachment() with empty data crashes with HTTP Error 400: Bad Request |
Ah, got it. It happens if data is empty. Reproducible on staging with
>>> b=lp.bugs[89040] (comment= '', data='', description= 'ThreadStacktra ce.txt (retraced)', filename= 'ThreadStacktra ce.txt' , is_patch=False)
>>> b.addAttachment
I'll work around this in apport.