]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1436619 - http:// in URL field
authorKohei Yoshino <kohei.yoshino@gmail.com>
Wed, 31 Oct 2018 20:38:13 +0000 (16:38 -0400)
committerDylan William Hardison <dylan@hardison.net>
Wed, 31 Oct 2018 20:38:13 +0000 (16:38 -0400)
16 files changed:
Bugzilla/Bug.pm
enter_bug.cgi
extensions/BMO/template/en/default/bug/create/create-client-bounty.html.tmpl
extensions/BMO/template/en/default/bug/create/create-doc.html.tmpl
extensions/BMO/template/en/default/bug/create/create-itrequest.html.tmpl
extensions/BMO/template/en/default/bug/create/create-legal.html.tmpl
extensions/BMO/template/en/default/bug/create/create-mobile-compat.html.tmpl
extensions/BMO/template/en/default/bug/create/create-mozlist.html.tmpl
extensions/BMO/template/en/default/bug/create/create-trademark.html.tmpl
extensions/BMO/template/en/default/bug/create/create-user-engagement.html.tmpl
extensions/BMO/template/en/default/bug/create/create-web-bounty.html.tmpl
extensions/BugModal/template/en/default/bug_modal/edit.html.tmpl
extensions/BugModal/template/en/default/bug_modal/field.html.tmpl
template/en/default/bug/create/create-guided.html.tmpl
template/en/default/bug/create/create.html.tmpl
template/en/default/bug/edit.html.tmpl

index ee48ed7a2b030840688a6b6a3bee3cde9e8beb9a..2cebacbb82e2d20f10f894a2bea0be5942371d57 100644 (file)
@@ -1678,12 +1678,8 @@ sub _check_assigned_to {
 sub _check_bug_file_loc {
     my ($invocant, $url) = @_;
     $url = '' if !defined($url);
-    # On bug entry, if bug_file_loc is "http://", the default, use an
-    # empty value instead. However, on bug editing people can set that
-    # back if they *really* want to.
-    if (!ref $invocant && $url eq 'http://') {
-        $url = '';
-    }
+    # TODO: Add validation. It has to be loose, since we have accepted `data:`,
+    # `javascript:` and any other values on the URL field.
     return $url;
 }
 
index 33cdf853520ea62ede594ec8dd7d846ac6e4867f..52528a5e9bfde1e5c05f9c8ee9eb510892956555 100755 (executable)
@@ -306,7 +306,7 @@ else {
 
     $vars->{'alias'}          = formvalue('alias');
     $vars->{'short_desc'}     = formvalue('short_desc');
-    $vars->{'bug_file_loc'}   = formvalue('bug_file_loc', "http://");
+    $vars->{'bug_file_loc'}   = formvalue('bug_file_loc');
     $vars->{'keywords'}       = formvalue('keywords');
     $vars->{'dependson'}      = formvalue('dependson');
     $vars->{'blocked'}        = formvalue('blocked');
index 14cc7b94e0ce0fc4e9a0d8fdc65e6cd7334d9954..b188a00d09a6cb868fb7eda9ee67c48b1b7b4a97 100644 (file)
@@ -165,7 +165,7 @@ function validateAndSubmit() {
     The full URL (hostname/subpage) where the issue exists (if the URL is especially long
     please just include it in the comments)
   </div>
-  <input type="text" name="bug_file_loc" id="bug_file_loc" size="80">
+  <input type="text" name="bug_file_loc" id="bug_file_loc" size="80" placeholder="https://">
 </div>
 
 <div class="form_section">
index 61460b4eca470956039ad6c8c97b3d4dce3f3c53..d040e58bc7c419bc962d20388b9b2890bff9ab6c 100644 (file)
@@ -139,7 +139,7 @@ function validateAndSubmit() {
   <th>Page to Update</th>
   <td>
     <input type="text" name="bug_file_loc" id="short_desc" size="60"
-           value="[% bug_file_loc FILTER html %]">
+           value="[% bug_file_loc FILTER html %]" placeholder="https://">
   </td>
 </tr>
 
index 60eb2cbfed0c757ba72a945352e3182c829d74e1..8bd51c09d228905e9241bae3e768277aca0cf6b7 100644 (file)
         <td align="right"><strong>URL&nbsp;(optional):</strong></td>
         <td colspan="3">
           <input name="bug_file_loc" size="60"
-                value="[% bug_file_loc FILTER html %]">
+                value="[% bug_file_loc FILTER html %]" placeholder="https://">
         </td>
       </tr>
 
index 0a75cab2b1bba2a1d54b0e0972b753110efecabe..55deedc65394c21cd12225042a7dd5531f61886f 100644 (file)
@@ -179,7 +179,7 @@ label.required:before {
       <label for="bug_file_loc">URL:</label>
     </th>
     <td>
-      <input type="text" name="bug_file_loc" id="bug_file_loc" size="60">
+      <input type="text" name="bug_file_loc" id="bug_file_loc" size="60" placeholder="https://">
     </td>
   </tr>
 
index 8f5cd038b290352e16a5e78860cc9c02c6609f97..31c5f98f014c92031f24424c641f90b5d161a1f3 100644 (file)
@@ -123,7 +123,7 @@ function validateAndSubmit() {
   <th class="required">Full Web Page Address</th>
   <td>
     <input type="text" name="bug_file_loc" id="bug_file_loc" size="60"
-      placeholder="e.g. http://www.example.com/page.html">
+      placeholder="https://">
   </td>
 </tr>
 
index b5d9579a8e572d3eab70b1dfc718596730eaabfd..f1b5326e2c54e72a5ad76099450d1945aa56fe83 100644 (file)
     <th class="field_label">URL:</th>
     <td colspan="3">
       <input name="bug_file_loc" size="60"
-             value="[% bug_file_loc FILTER html %]">
+             value="[% bug_file_loc FILTER html %]" placeholder="https://">
     </td>
   </tr>
   <tr>
index 2788c01d456d0fc6fa03f9a9340282119488f31f..051a394c72359ce1e3ce063573d05e068e91cde3 100644 (file)
@@ -69,7 +69,7 @@
       <td align="right"><strong>URL&nbsp;(optional):</strong></td>
       <td colspan="3">
         <input name="bug_file_loc" size="60"
-               value="[% bug_file_loc FILTER html %]">
+               value="[% bug_file_loc FILTER html %]" placeholder="https://">
       </td>
     </tr>
   </table>
index 304aecabf9e3873fa6df3c4ec73fa1577b0bab09..b8a4f5d5edd403af00c89bfc81422d743f5d9647 100644 (file)
@@ -148,7 +148,7 @@ function toggleGoalOther() {
   <div class="field_desc">
     Where would the user be sent when they click on the promotion?
   </div>
-  <input type="text" name="bug_file_loc" id="bug_file_loc" size="80">
+  <input type="text" name="bug_file_loc" id="bug_file_loc" size="80" placeholder="https://">
 </div>
 
 <div class="form_section">
index 1e9b41a11207e4d7c52404ef18d7dc0f7c285af8..62e4dd721935d4e85781810eaa759552458bbcaf 100644 (file)
@@ -117,7 +117,7 @@ function validateAndSubmit() {
     The full URL (hostname/subpage) where the issue exists (if the URL is especially long
     please just include it in the comments)
   </div>
-  <input type="text" name="bug_file_loc" id="bug_file_loc" size="80">
+  <input type="text" name="bug_file_loc" id="bug_file_loc" size="80" placeholder="https://">
 </div>
 
 <div class="form_section">
index a7362790f1ef7390a8dcd09650e5f53bba1030e5..4222323aeabe5f16b74d558e3b2306bb406689d5 100644 (file)
         field = bug_fields.bug_file_loc
         field_type = constants.FIELD_TYPE_FREETEXT
         hide_on_view = bug.bug_file_loc == ""
+        default = "https://"
         help = "https://wiki.mozilla.org/BMO/UserGuide/BugFields#bug_file_loc"
     %]
       [% INCLUDE bug_url_link %]
index 2dce818c56d216d3874bf701d39af8a6fcd0e9dd..e6933ef29024e4e6e27e9bcf19ec46f09366d699 100644 (file)
@@ -217,7 +217,9 @@ END;
 
         [% CASE constants.FIELD_TYPE_FREETEXT %]
           [%# normal input field %]
-          <input name="[% name FILTER html %]" id="[% name FILTER html %]" value="[% value FILTER html %]" [% aria_labelledby_html FILTER none +%] [% " required" IF required %]>
+          <input name="[% name FILTER html %]" id="[% name FILTER html %]" value="[% value FILTER html %]"
+                 [% IF default %] placeholder="[% default FILTER html %]"[% END %]
+                 [%+ aria_labelledby_html FILTER none +%] [% " required" IF required %]>
         [% CASE constants.FIELD_TYPE_USER %]
           [% IF action && !action.hidden %]
             <button class="field-button minor [%= action.class FILTER html IF action.class %]"
index 128fdb9babf15aabea810dd20f70551628641a82..f0cfb71a17211b15ca35c022eca522058522b2e7 100644 (file)
@@ -233,7 +233,7 @@ function PutDescription() {
       <b>URL</b>
     </td>
     <td valign="top">
-      <input type="text" size="80" name="bug_file_loc" value="http://">
+      <input type="text" size="80" name="bug_file_loc" placeholder="https://">
       <p>
         URL that demonstrates the problem you are seeing (optional).<br>
         <b>IMPORTANT</b>: if the problem is with a broken web page, you need
index 3b59b376bf59a19b003485d2ee1543be1edfd925..5bc7188a54cfbf739ebd37897ad043cbeddfe32e 100644 (file)
@@ -552,7 +552,7 @@ TUI_hide_default('expert_fields');
     %]
     <td colspan="3" class="field_value">
       <input name="bug_file_loc" id="bug_file_loc" class="text_input"
-             size="40" value="[% bug_file_loc FILTER html %]">
+             size="40" value="[% bug_file_loc FILTER html %]" placeholder="https://">
     </td>
   </tr>
 </tbody>
index 6d629a3fecb3cadc5ca51afbff39ddad4ac7822d..0788b2d7fa87e1c968251aaf5924f9882f2f6e48 100644 (file)
         </span>
       [% END %]
       <span id="bz_url_input_area">
-        [% url_output =  INCLUDE input no_td=1 inputname => "bug_file_loc" size => "40" colspan => 2 %]
+        [% url_output = INCLUDE input
+          no_td = 1
+          colspan = 2
+          inputname = "bug_file_loc"
+          size = "40"
+          placeholder = "https://"
+        %]
         [% IF NOT bug.check_can_change_field("bug_file_loc", 0, 1)
               AND is_safe_url(bug.bug_file_loc) %]
           <a href="[% bug.bug_file_loc FILTER html %]"
     [% IF bug.check_can_change_field(inputname, 0, 1) %]
        <input id="[% inputname %]" name="[% inputname %]" class="text_input"
               value="[% val FILTER html %]"[% " size=\"$size\"" IF size %]
+              [% IF placeholder %] placeholder="[% placeholder FILTER html %]"[% END %]
               [% " maxlength=\"$maxlength\"" IF maxlength %]
               [% " spellcheck=\"$spellcheck\"" IF spellcheck %]>
     [% ELSE %]