]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
fix for 37684 and 42609: trying to deal with malformed url's in the URL field
authorcyeh%bluemartini.com <>
Thu, 31 Aug 2000 04:32:43 +0000 (04:32 +0000)
committercyeh%bluemartini.com <>
Thu, 31 Aug 2000 04:32:43 +0000 (04:32 +0000)
during bug entry. instead of trying to be really intelligent over what a valid
url field is, or doing any kind of complicated regexping and forcing http://
on everyone, what we do instead is pre-seed enter_bug.cgi bug_file_loc with http://
in the text field. if that is all there is in the field when we are in post_bug.cgi,
then the value gets set to null (no URL entered into the new bug form). this allows
for you to enter in any valid url that you want, but also make it obvious that
http:// should be there for http:// urls at bug entry time

enter_bug.cgi
post_bug.cgi

index 8df634fd2aa78988a1601df32a31f294a737fc45..cd68bfdea475484bff35324985bac14a8a936762 100755 (executable)
@@ -384,7 +384,7 @@ print "
   <TR>
     <TD ALIGN=RIGHT><B>URL:</B>
     <TD COLSPAN=5>
-      <INPUT NAME=bug_file_loc SIZE=60 value=\"" .
+      <INPUT NAME=bug_file_loc SIZE=60 value=\"http://" .
     value_quote(formvalue('bug_file_loc')) .
     "\"></TD>
   </TR>
index 3f933e2d2fdb902ff4a451cfe076acde3ca4c9fc..a9878ba6aeddf9d2c6d08d3990573b157a01b9af 100755 (executable)
@@ -178,7 +178,21 @@ VALUES (
 ";
 
 foreach my $field (@used_fields) {
-    $query .= SqlQuote($::FORM{$field}) . ",\n";
+# fix for 42609. if there is a http:// only in bug_file_loc, strip
+# it out and send an empty value. 
+    if ($field eq 'bug_file_loc') {
+       if ($::FORM{$field} eq 'http://') {
+           $::FORM{$field} = "";
+           $query .= SqlQuote($::FORM{$field}) . ",\n";
+           next;
+       } 
+       else {
+          $query .= SqlQuote($::FORM{$field}) . ",\n";
+       }
+    }
+    else {
+       $query .= SqlQuote($::FORM{$field}) . ",\n";
+    }
 }
 
 my $comment = $::FORM{'comment'};