-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix incorrect link handling of inline MD images #4543
Fix incorrect link handling of inline MD images #4543
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @abdusabri
Tested, looks good to merge.
Markdown has a pointer and opens in the preview as expected.
Test server destroyed |
This issue has been automatically labelled "stale" because it hasn't had recent activity. /cc @jasonblais @hanzei |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abdusabri 👍 Thanks for the PR.
/update-branch |
Will try to auto merge this PR once all tests and checks are passing. This might take up to an hour. |
This can be cherry-picked to v5.19 as long as it's not risky. @sudheerDev |
/cherry-pick release-5.19 |
Error trying doing the automated Cherry picking. Please do this manually
|
@amyblais will manually cherrypick |
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Summary
As of MM-12898, inline markdown images open the image preview modal, except if the markdown image itself is a link. e.g.
[![Build Status](https://travis-ci.org/mattermost/platform.svg?branch=master)](https://travis-ci.org/mattermost/platform)
.This PR fixes the following bug:
For a case like
![image](https://www.mattermost.org/wp-content/uploads/2016/03/logoHorizontal.png) an image plus some text that has [a link](http://somelink)
Observed behavior: The image doesn't have a pointer cursor, and doesn't open the preview modal
Expected behavior: The image should have a pointer cursor and open the preview modal
Reason of wrong behavior: just because there is a link (
[a link](http://somelink)
) in the markdown, it falsely assumed that the image itself is actually a link - which is not the case in the example given aboveThe bug is not a regression, it is a missed case since the implementation of MM-12898, but was only discovered after MM-15232, MM-18158. The issue can be reproduced on community V5.18 and latest master. The bug is not limited to channel header descriptions or its associated system messages, and can be reproduced in regular chat messages as well.
Ticket Link
https://mattermost.atlassian.net/browse/MM-21519
Screenshots
Before the fix
After the fix