]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1518967 - Edit attachment as comment does markdown, which is very unexpected
authorDylan William Hardison <dylan@hardison.net>
Fri, 11 Jan 2019 22:15:08 +0000 (17:15 -0500)
committerGitHub <noreply@github.com>
Fri, 11 Jan 2019 22:15:08 +0000 (17:15 -0500)
attachment.cgi
extensions/BMO/template/en/default/hook/attachment/edit-view.html.tmpl
template/en/default/attachment/edit.html.tmpl

index b165651e467dda3aa9f0f4a5d9effe13dd0c246a..df1b009fbb5f18166589f45575af2f572d516caa 100755 (executable)
@@ -619,10 +619,10 @@ sub insert {
   $bug->add_comment(
     $comment,
     {
-      isprivate  => $attachment->isprivate,
-      type       => CMT_ATTACHMENT_CREATED,
-      extra_data => $attachment->id,
-      is_markdown => Bugzilla->params->{use_markdown} ? 1 : 0
+      isprivate   => $attachment->isprivate,
+      type        => CMT_ATTACHMENT_CREATED,
+      extra_data  => $attachment->id,
+      is_markdown => Bugzilla->params->{use_markdown} ? 1 : 0,
     }
   );
 
@@ -775,14 +775,18 @@ sub update {
   # If the user submitted a comment while editing the attachment,
   # add the comment to the bug. Do this after having validated isprivate!
   my $comment = $cgi->param('comment');
+  my $is_markdown = Bugzilla->params->{use_markdown} ? 1 : 0;
+  if ($cgi->param('markdown_off')) {
+    $is_markdown = 0;
+  }
   if (defined $comment && trim($comment) ne '') {
     $bug->add_comment(
       $comment,
       {
-        isprivate  => $attachment->isprivate,
-        type       => CMT_ATTACHMENT_UPDATED,
-        extra_data => $attachment->id,
-        is_markdown => Bugzilla->params->{use_markdown} ? 1 : 0
+        isprivate   => $attachment->isprivate,
+        type        => CMT_ATTACHMENT_UPDATED,
+        extra_data  => $attachment->id,
+        is_markdown => $is_markdown,
       }
     );
   }
index e28a142ae8273f28d6be1e66a023e955ca2f8bf2..52b369106af403f677743f40b711766f5c0645a8 100644 (file)
@@ -21,6 +21,7 @@
 [% attachment_data = attachment.fetch_github_pr_diff %]
 
 <div>
+  <input type="hidden" name="markdown_off" value="1">
   [% INCLUDE global/textarea.html.tmpl
     id       = 'editFrame'
     name     = 'comment'
index 9bec3544207ec08534d49ac76a86a58cfc6f9e92..13f143eebe84afc7e378b195736e72ab7101c940 100644 (file)
           [% Hook.process('view') %]
           [% UNLESS custom_attachment_viewer %]
             <div>
+              <input type="hidden" name="markdown_off" value="1">
               [% INCLUDE global/textarea.html.tmpl
                 id      = 'editFrame'
                 name    = 'comment'