Skip to content

Commit

Permalink
Merge pull request #1255 from /issues/1249/1
Browse files Browse the repository at this point in the history
Fixes #1249: support a src param to track "reported-with"
  • Loading branch information
karlcow authored Dec 28, 2016
2 parents a6cdde4 + 2b37a36 commit 22967c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion webcompat/static/js/lib/bugform.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function BugForm() {
if (!location.search.search(/open=1/) && !location.search.search(/url=/)) {
return;
}
var urlParam = location.search.match(/url=(.+)/);
var urlParam = location.href.match(/url=([^&]*)/);
if (urlParam != null) {
// weird Gecko bug. See https://bugzilla.mozilla.org/show_bug.cgi?id=1098037
urlParam = this.trimWyciwyg(urlParam[1]);
Expand Down
12 changes: 10 additions & 2 deletions webcompat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ def create_issue():
bug_form = get_form(request.headers.get('User-Agent'))
if g.user:
get_user_info()
if request.args.get('src'):
session['src'] = request.args.get('src')
return render_template('new-issue.html', form=bug_form)
# copy the form so we can add the full UA string to it.
form = request.form.copy()
Expand All @@ -175,8 +177,14 @@ def create_issue():
flash(msg, 'notimeout')
return redirect(url_for('index'))
form['ua_header'] = request.headers.get('User-Agent')
# Store where the report originated from
form['reported_with'] = request.headers.get('X-Reported-With', 'web')
# Currently we support either a src GET param, or X-Reported-With header
# to track where the report originated from.
# See https://github.com/webcompat/webcompat.com/issues/1254 to track
# supporting only the src param
if session.get('src'):
form['reported_with'] = session.pop('src')
else:
form['reported_with'] = request.headers.get('X-Reported-With', 'web')
# Logging the ip and url for investigation
log = app.logger
log.setLevel(logging.INFO)
Expand Down

0 comments on commit 22967c9

Please sign in to comment.