View Issue Details

IDProjectCategoryView StatusLast Update
0026726mantisbtotherpublic2020-03-10 17:23
ReporterWma Assigned Todregad  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionwon't fix 
Product Version2.23.0 
Summary0026726: Question: Is it possible to insert a link in a notice?
Description

Is it possible to insert a link in a Mantis notice that works in a browser?
The file should be downloaded and displayed.

If I insert a link like the screenshot. It do nothing.

TagsNo tags attached.
Attached Files
image.png (7,116 bytes)   
image.png (7,116 bytes)   

Activities

thE_iNviNciblE

thE_iNviNciblE

2020-02-19 07:47

reporter   ~0063660

this feature doesn't exist.

dregad

dregad

2020-02-19 12:02

developer   ~0063664

Not sure I fully understand what you want to do.

Mantis lets you type an URL and will turn it into a hyperlink e.g. http://example.com (unless corresponding URL Processing feature from MantisCoreFormatting plugin is turned off).
If you want to upload a file, then you can do so by adding an attachment (as you have done here).

What it cannot do is interpret an URL and automatically upload the linked file as an attachment.

Wma

Wma

2020-02-20 03:53

reporter   ~0063667

I know that I can upload a file (e.g. PDF). I also use the link via http:\xxx to access other URLs. This all works correctly.
So that I don't have to upload the file, or specify a directory, I want to attach a file link from our server.
This would allow another colleague to access the file or directory directly without uploading the file.

Clicking the link will fetch and display the file or open the directory. (As in Outlook via CTRL key).

dregad

dregad

2020-02-20 06:26

developer   ~0063668

The problem is that the Parsedown library we use to process Markdown, does not hyperlink file:// URIs, only http/https are supported (see https://github.com/erusev/parsedown/blob/1.7.3/Parsedown.php#L1410)

Since modifying the library's code is not something we would do, this is not fixable.

You can try to change the regex in your installation, i.e. update line 1410, like so:

-        if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE))
+        if (preg_match('/\b(?:https?|file):[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE))

A slightly cleaner, but more complex solution would be to override the inlineUrl() method in the MantisMarkdown class.

Note that these are just suggestions, and is not supported. Do it at your own risk.

If you're not using it, you could also consider disabling Markdown processing (in MantisCoreFormatting plugin options), as the legacy MantisBT code to process URLs does support file://.