Skip to content

Commit

Permalink
Fixes #391 - trim wysiwyg:// from URL field if it's there.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Taylor committed Nov 13, 2014
1 parent ed52355 commit 498fa4f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion webcompat/static/js/lib/bugform.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,22 @@ function BugForm() {
}
var urlParam = location.search.match(/url=(.+)/);
if (urlParam != null) {
urlField.val(decodeURIComponent(urlParam[1]));
// weird Gecko bug. See https://bugzilla.mozilla.org/show_bug.cgi?id=1098037
urlParam = self.trimWysiwyg(urlParam[1]);
urlField.val(decodeURIComponent(urlParam));
self.copyURL();
self.makeValid('url');
}
},
trimWysiwyg: function(url) {
//trim wysiwyg://N/ from URL.
var wysiwygRe = /(wysiwyg:\/\/\d+\/)/i;
if (url.search(wysiwygRe) !== 0) {
return url;
} else {
return url.replace(wysiwygRe, '');
}
},
disableSubmits: function() {
submitButtons.prop('disabled', true);
submitButtons.addClass('is-disabled');
Expand Down

0 comments on commit 498fa4f

Please sign in to comment.