@@ -145,17 +145,17 @@ def normalize_url(url):
145
145
# if url starts with a bad scheme, parsed.netloc will be empty,
146
146
# so we use parsed.path instead
147
147
path = parsed .path .lstrip ('/' )
148
- url = '{}://{}' .format (parsed .scheme , path )
148
+ url = u '{}://{}' .format (parsed .scheme , path )
149
149
if parsed .query :
150
150
url += '?' + parsed .query
151
151
if parsed .fragment :
152
152
url += '#' + parsed .fragment
153
153
elif not parsed .scheme :
154
154
# We assume that http is missing not https
155
155
if url .startswith ("//" ):
156
- url = "http://{}" .format (url [2 :])
156
+ url = u "http://{}" .format (url [2 :])
157
157
else :
158
- url = 'http://{}' .format (url )
158
+ url = u 'http://{}' .format (url )
159
159
return url
160
160
161
161
@@ -221,15 +221,16 @@ def build_formdata(form_object):
221
221
NOTE: Add milestone "needstriage" when create new issue
222
222
"""
223
223
# Do domain extraction for adding to the summary/title
224
+ # form_object always returns a unicode string
224
225
url = form_object .get ('url' )
225
226
normalized_url = normalize_url (url )
226
227
domain = domain_name (normalized_url )
227
228
problem_summary = get_problem_summary (form_object .get ('problem_category' ))
228
229
229
230
if domain :
230
- summary = '{0} - {1}' .format (domain , problem_summary )
231
+ summary = u '{0} - {1}' .format (domain , problem_summary )
231
232
else :
232
- summary = '{0} - {1}' .format (normalized_url , problem_summary )
233
+ summary = u '{0} - {1}' .format (normalized_url , problem_summary )
233
234
234
235
metadata_keys = ['browser' , 'ua_header' , 'reported_with' ]
235
236
extra_label = form_object .get ('extra_label' , None )
@@ -265,7 +266,7 @@ def build_formdata(form_object):
265
266
""" .format (** formdata )
266
267
# Add the image, if there was one.
267
268
if form_object .get ('image_upload' ) is not None :
268
- body += '\n \n ' .format (
269
+ body += u '\n \n ' .format (
269
270
image_url = form_object .get ('image_upload' ).get ('url' ))
270
271
# Append "from webcompat.com" message to bottom (for GitHub issue viewers)
271
272
body += u'\n \n {0}' .format (GITHUB_HELP )
0 commit comments