Skip to content
Snippets Groups Projects
Commit ec10d366 authored by jf-guillou's avatar jf-guillou
Browse files

Exclude parenthesis from matching in url fragment

parent 6519c20e
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ RocketChat.sendMessage = (user, message, room, options) ->
message.rid = room._id
if message.parseUrls isnt false
if urls = message.msg.match /([A-Za-z]{3,9}):\/\/([-;:&=\+\$,\w]+@{1})?([-A-Za-z0-9\.]+)+:?(\d+)?((\/[-\+=!:~%\/\.@\,\w]+)?\??([-\+=&!:;%@\/\.\,\w]+)?(?:#([^\s]+))?)?/g
if 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: url
message = RocketChat.callbacks.run 'beforeSaveMessage', message
......
......@@ -33,7 +33,7 @@ Meteor.methods
_id: Meteor.userId()
username: me.username
if urls = message.msg.match /([A-Za-z]{3,9}):\/\/([-;:&=\+\$,\w]+@{1})?([-A-Za-z0-9\.]+)+:?(\d+)?((\/[-\+=!:~%\/\.@\,\w]+)?\??([-\+=&!:;%@\/\.\,\w]+)?(?:#([^\s]+))?)?/g
if 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: url
message = RocketChat.callbacks.run 'beforeSaveMessage', message
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment