From 346e94d0fd3eee1eb11b22577b3254e6bebd5701 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 23 Dec 2016 17:53:50 -0600 Subject: [PATCH 1/2] Issue #1249. Read reported_with value from src param, if it exists. --- webcompat/views.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/webcompat/views.py b/webcompat/views.py index aac25c005..34998e55a 100644 --- a/webcompat/views.py +++ b/webcompat/views.py @@ -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() @@ -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) From 2b37a36a0b30eb573c6d3cf8f1107c92ad1160ea Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 23 Dec 2016 18:02:22 -0600 Subject: [PATCH 2/2] Issue #1249. Don't grab any remaining GET args when grabbing url. --- webcompat/static/js/lib/bugform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webcompat/static/js/lib/bugform.js b/webcompat/static/js/lib/bugform.js index 17c3d10c0..9fe18dd9b 100644 --- a/webcompat/static/js/lib/bugform.js +++ b/webcompat/static/js/lib/bugform.js @@ -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]);