Skip to content

Conversation

@KevLehman
Copy link
Member

Proposed changes (including videos or screenshots)

  • Fix updateMessage to avoid parsing URLs inside markdown
  • Honor parseUrls property when updating messages

Issue(s)

Steps to test or reproduce

Further comments

@KevLehman KevLehman changed the title Fix updateMessage to avoid parsing urls inside markdown [Fix] Update updateMessage to avoid parsing urls inside markdown Apr 8, 2021
Copy link
Member

@sampaiodiego sampaiodiego left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also pls add at least some e2e tests? =)


const urls = message.msg.match(/([A-Za-z]{3,9}):\/\/([-;:&=\+\$,\w]+@{1})?([-A-Za-z0-9\.]+)+:?(\d+)?((\/[-\+=!:~%\/\.@\,\w]*)?\??([-\+=&!:;%@\/\.\,\w]+)?(?:#([^\s\)]+))?)?/g) || [];
message.urls = urls.map((url) => ({ url }));
if (message.parseUrls !== false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would make sense to move this code to a common function and use on sendMessage and here at updateMessage instead of having this code duplicated, wdyt?

if (message.parseUrls !== false) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@KevLehman KevLehman requested a review from sampaiodiego April 9, 2021 19:08
@sampaiodiego sampaiodiego changed the title [Fix] Update updateMessage to avoid parsing urls inside markdown [FIX] Updating a message causing URLs to be parsed even within markdown code Apr 15, 2021
@sampaiodiego sampaiodiego merged commit f05b07c into develop Apr 15, 2021
@sampaiodiego sampaiodiego deleted the fix/update-message-url-parse branch April 15, 2021 14:02
gabriellsh added a commit that referenced this pull request Apr 15, 2021
…user_info

* 'develop' of github.com:RocketChat/Rocket.Chat: (40 commits)
  [FIX] Typos/missing elements in the French translation (#21525)
  [FIX] Archive permissions for room moderator (#21563)
  [FIX] Checking 'start-discussion' Permission for MessageBox Actions (#21564)
  [FIX] Correcting the case there are no result in admin users list (#21556)
  [FIX] Don't allow whitespace on bold, italic and strike (#21483)
  [FIX] Message Block ordering (#21464)
  [IMPROVE] Add proxy for data export (#20998)
  [FIX] Updating a message causing URLs to be parsed even within markdown code (#21489)
  Bump version to 3.13.2
  [FIX] Fix the bugs opening discussions (#21557)
  A React-based replacement for BlazeLayout (#21527)
  Language update from LingoHub 🤖 on 2021-04-12Z (#21530)
  Chore: Increase testing coverage on password policy class (#21482)
  Chore: Meteor update to 2.1.1 (#21494)
  Chore: Do not stop animations on Test Mode (#21484)
  Chore: Remove control character from room model operation (#21493)
  [NEW] New set of rules for client code (#21318)
  Bump version to 3.13.1
  [FIX] Header component breaking if user is not part of teams room (#21465)
  [FIX] Admin Users list pagination (#21469)
  ...
@sampaiodiego sampaiodiego mentioned this pull request Apr 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants