Skip to content

Commit 29587c0

Browse files
committed
Limit issue report titles to 256 chars
Or GitHub throw's a HTTP 422
1 parent 86cd1ca commit 29587c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/aussieaddonscommon/issue_reporter.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ def generate_report(title, log_url=None, trace=None, connection_info={}):
271271
content.append("\n[Full log](%s)" % log_url)
272272

273273
short_id = utils.get_addon_id().split('.')[-1]
274+
title = '[%s] %s' % (short_id, title)
275+
# Github throws HTTP 422 if title is too long
274276
report = {
275-
'title': '[%s] %s' % (short_id, title),
277+
'title': title[:255],
276278
'body': '\n'.join(content)
277279
}
278280

@@ -284,7 +286,8 @@ def upload_report(report):
284286
response = urllib2.urlopen(make_request(ISSUE_API_URL),
285287
json.dumps(report))
286288
except urllib2.HTTPError as e:
287-
utils.log("Failed to report issue: HTTPError %s" % e.code)
289+
utils.log("Failed to report issue: HTTPError %s\n %s" % (
290+
e.code, e.read()))
288291
return False
289292
except urllib2.URLError as e:
290293
utils.log("Failed to report issue: URLError %s" % e.reason)

0 commit comments

Comments
 (0)