|
5 | 5 |
|
6 | 6 |
|
7 | 7 | import { gWorkItemRESTClient } from './Globals'; |
8 | | -import { DiffHtmlText } from './Utils'; |
| 8 | +import { DiffHtmlText, EscapeHtml } from './Utils'; |
9 | 9 | import { CommentFormat } from 'azure-devops-extension-api/Comments'; |
10 | 10 |
|
11 | 11 |
|
@@ -174,13 +174,20 @@ function GetHtmlFromComment(comment, commentOrUpdate) |
174 | 174 | // - format == markdown: GetCommentsRESTRequest(), `text` |
175 | 175 | // GetCommentsVersionsRESTRequest(): Never (`text` contains ACK) |
176 | 176 | // |
177 | | - if (comment.format === undefined || comment.format === CommentFormat.Html || commentOrUpdate.renderedText === undefined) { |
178 | | - return commentOrUpdate.text; // For html, do NOT use renderedText! See above! |
| 177 | + if (comment.format === undefined || comment.format === CommentFormat.Html) { |
| 178 | + // If `format` is undefined, we have an old ADO version, implying html. |
| 179 | + // Moreover, the correct html is in `text`, not in `renderedText`. See above. |
| 180 | + return commentOrUpdate.text; |
179 | 181 | } |
180 | | - else { |
181 | | - // Probably a markdown comment, at least now (might have been html in earlier versions of the comment). |
| 182 | + else if (commentOrUpdate.renderedText !== undefined) { |
| 183 | + // Probably a markdown comment, at least in the latest comment version (might have been html in earlier |
| 184 | + // versions of the comment, in which case `renderedText` is also fine; compare explanation above). |
182 | 185 | return commentOrUpdate.renderedText; |
183 | 186 | } |
| 187 | + else { |
| 188 | + // We shouldn't be able to reach this code here. |
| 189 | + return EscapeHtml(commentOrUpdate.text); |
| 190 | + } |
184 | 191 | } |
185 | 192 |
|
186 | 193 |
|
|
0 commit comments