View Issue Details

IDProjectCategoryView StatusLast Update
0023738mantisbtmarkdownpublic2024-04-14 07:38
Reporterrichardmoss Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version2.6.0 
Target Version2.27.0Fixed in Version2.27.0 
Summary0023738: Mantis issue links displayed as raw HTML in code block
Description

Hello,

I created an issue which included a stack trace where each line was indented by four spaces to trigger a markdown code block.

The stack trace includes #nnn sequences which can either be IL offsets or line numbers. Unfortunately MantisBT treats these as issue links and create hyperlinks if it notices that a matching issue is found. When looking at one of these issues I noticed that the transform is also happening to the markdown code blocks, meaning raw HTML is displayed.

For example

at System.Collections.Hashtable.rehash(Int32, Boolean) #_7

Is rendered as

at System.Collections.Hashtable.rehash(Int32, Boolean) <a href="/view.php?id=7" title="[closed] issuetitlegoeshere" class="resolved">0000007</a>

(Note I I stuck an underscore in the first example line in case it triggers the generation of a link on this instance too)

Steps To Reproduce

Create an issue similar to the following

Logged occurrence filling the `LinksListView` control hosted in the `WebsiteLinksDialog`

    at System.Collections.Hashtable.rehash(Int32, Boolean) #7
    at System.Collections.Hashtable.expand() #14
    at System.Collections.Hashtable.Insert(System.Object, System.Object, Boolean) #38
    at System.Collections.Hashtable.Add(System.Object, System.Object)
    at System.Windows.Forms.ListView.InsertItems(Int32, System.Windows.Forms.ListViewItem[], Boolean) #290
    at System.Windows.Forms.ListView.ApplyUpdateCachedItems() #68
    at System.Windows.Forms.ListView.EndUpdate() #37
    at Cyotek.Web.Crawler.Ui.LinksListView.() #120
    at Cyotek.Web.Crawler.Ui.LinksListView.Bind(System.Collections.Generic.IEnumerable`1[Cyotek.Web.Crawler.LinkInfo])
    at Cyotek.Web.Crawler.Ui.WebsiteLinksDialog.()
    at Cyotek.Web.Crawler.Ui.WebsiteLinksDialog.OnLoad(System.EventArgs)
Additional Information

I have included a screenshot shown the full example.

I'm a couple of versions out, I find upgrading a bit of a fiddly process - I'll get the instance updated to the latest version presently and update this ticket if anything changes.

TagsNo tags attached.
Attached Files
htmlissue.png (84,116 bytes)   
htmlissue.png (84,116 bytes)   

Activities

richardmoss

richardmoss

2017-12-17 07:20

reporter   ~0058407

I'm not able to edit the issue, but I see that my example in Steps To Reproduce is being rendered the "corrupt" way - I probably should have stuck underscores between the # and digits there too.

Related Changesets

MantisBT: master 3aec6e68

2024-03-31 23:15

grummbeer

Committer: dregad


Details Diff
Clean up markdown processing

- Process input via Markdownparser and return the result, no further
text processing.
- During parsing, catch all <code> blocks and replace them with a hash
value.
- After the markup is returned from Parsedown, apply mentions and links
- Restore the untouched <code> Blocks back in place.

Fixes 0034040, PR https://github.com/mantisbt/mantisbt/pull/1976
Also fixes 0022315, 0022320, 0024241, 0024628, 0024810, 0022231, 0023738

Signed-off-by: Damien Regad <dregad@mantisbt.org>
Affected Issues
0022231, 0022315, 0022320, 0023738, 0024241, 0024628, 0024810, 0034040, 0034393
mod - plugins/MantisCoreFormatting/MantisCoreFormatting.php Diff File
mod - plugins/MantisCoreFormatting/core/MantisMarkdown.php Diff File