Skip to content

Commit

Permalink
Add bug hyperlink validation. Fixes kiwitcms#1147
Browse files Browse the repository at this point in the history
  • Loading branch information
RMadjev committed Oct 3, 2019
1 parent 42c1c55 commit 1a4d110
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions tcms/static/js/testrun_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,11 +757,19 @@ function initialize_addlink_dialog() {
},
buttons: {
"OK": function() {
var name = jQ('#testlog_name').attr('value');
var url = jQ('#testlog_url').attr('value');
var is_defect = $('#is_defect').is(':checked');
var update_tracker = $('#update_tracker').is(':checked');
var case_id = dialog_p.dialog('option', 'case_id');
var name = jQ('#testlog_name').attr('value'),
url = jQ('#testlog_url').attr('value'),
is_defect = $('#is_defect').is(':checked'),
update_tracker = $('#update_tracker').is(':checked'),
case_id = dialog_p.dialog('option', 'case_id'),
tmpAElement = document.createElement('a');

tmpAElement.href = url;

//check if url is valid
if (url.length === 0 || (tmpAElement.host && tmpAElement.host === window.location.host)) {
return;
}

dialog_p.dialog('close');

Expand Down

0 comments on commit 1a4d110

Please sign in to comment.