Eeems / EeeZorBot

Highly extensible Node.js IRC bot
Mozilla Public License 2.0
2 stars 2 forks source link

[log] url parsing #2

Open Sorunome opened 10 years ago

Sorunome commented 10 years ago

URL parsing is messed up, it doesn't stop at the end of the URL, e.g. http://chat.eeems.ca:9003/?server=irc.omnimaga.org%206667&channel=omnimaga&date=Mon%20Jan%2006%202014#1389065275159

Eeems commented 10 years ago

Seems to be a bad parse. If you could find me some better regex to use that would parse that correctly I would be much obliged :)

Current regex: https://github.com/Eeems/EeeZorBot/blob/master/scripts/log.js#L286

Sorunome commented 10 years ago

The regex used in OmnomIRC is text.replace(RegExp("(^|.)(((f|ht)(tp|tps):\/\/)[^\s\x02\x03\x0f\x16\x1d\x1f]*)","g"),'$1$2') Which still isn't perfect, it doesn't stop on quotes....

Eeems commented 10 years ago

How thoroughly did you test it?

Sorunome commented 10 years ago

tested it some, i mean, you know how OmnomIRC parses links, don't you? A downside is that it recognizes ftps as a valid protocol.... (blame netham :P ) Also, just saw that it comes with two regexes for that (to recognize www links) text = text.replace(RegExp("(^|.)(((f|ht)(tp|tps):\/\/)[^\s\x02\x03\x0f\x16\x1d\x1f]_)","g"),'$1$2'); text = text.replace(RegExp("(^|\s)(www.[^\s\x02\x03\x0f\x16\x1d\x1f]_)","g"),'$1$2');

Also, after quick googling, this might help: http://stackoverflow.com/questions/833469/regular-expression-for-url

Eeems commented 10 years ago

FTPS is a valid protocol ;) http://en.wikipedia.org/wiki/FTPS

These don't recognize non-url encoded links though do they? Mine does, which is also part of the problem.

Eeems commented 10 years ago

Fixed, moved URL parsing to client side.

Eeems commented 10 years ago

broke something else by fixing. Reverting somewhat.

Eeems commented 9 years ago

Mind checking the url parsing in the re-org branch? It should handle things a lot better.

Eeems commented 9 years ago

For where to look on the re-org branch for the url parsing, look here: scripts/logviewer.js#L315

Eeems commented 6 years ago

@Sorunome Have you checked this at all? Latest link handling in re-org: mods/log/scripts/http.js#L128