Commit graph

82 commits

Author SHA1 Message Date
mint
76b0923033
Fix tests for added domains
This fixes tests from previous commit by replacing i2p/loki with random
but still valid Handshake domains (porkbun.com/handshake)
2023-01-10 16:23:16 +01:00
tusooa
0e62e64339
Allow double dots in links 2022-12-28 12:15:35 -05:00
tusooa
3599ccf759
Do not break hashtag at zwnj 2022-12-26 10:15:43 -05:00
Haelwenn (lanodan) Monnier
8505286703 Make repository REUSE compliant 2022-07-10 08:47:13 +02:00
FloatingGhost
2567e2c107 add bare whitespace test 2021-12-30 19:46:42 +00:00
FloatingGhost
94aeffd227 Fix hashtag parsing at the end of lines 2021-12-30 19:41:30 +00:00
Mark Felder
98947c5d53 Fix parsing error on URLs ending in ) with no path separator. e.g., http://example.com) 2021-07-07 16:52:16 -05:00
lain
5758b8d50c Merge branch 'fix-mentions' into 'master'
Fix mentions in compact html

See merge request pleroma/elixir-libraries/linkify!37
2021-03-02 14:54:32 +00:00
lain
09e56b48d6 Merge branch 'fix/ip-urls-require-scheme' into 'master'
Require scheme to link IPv4 addresses

See merge request pleroma/elixir-libraries/linkify!40
2021-03-02 14:05:02 +00:00
lain
ce7a5a68c8 Merge branch 'fix/parens-stripping' into 'master'
Enhance parens stripping logic

See merge request pleroma/elixir-libraries/linkify!38
2021-03-02 14:04:23 +00:00
Mark Felder
3999a61535 Correct test for apostrophes on mentions. It wasn't validating anything. 2021-02-13 12:47:44 -06:00
Mark Felder
e004539a54 Auto linking of IP addresses requires a scheme has been provided 2021-01-27 17:42:09 -06:00
Mark Felder
26fa3bffeb Try to make intelligent decisions when deciding if parens should be stripped before linking
This logic is torture and needs some rework.

Rules:

- Always strip leading (, as it can't be part of a URL
- Short circuit to only strip leading if no trailing
- If valid email address when trailing ) stripped, we can strip trailing )
- If not even a valid URL without trailing ), short circuit to only strip leading
- If query parameters detected, strip trailing. It should have been encoded as %29.
- If there isn't a / the trailing ) can't be part of the URL, strip trailing.
- If there isn't at least one ( in the URI.path, only strip leading. Assume ) is not part of the URL.
- If we have an equal count of ( and ) chars with the leading ( already stripped, only strip leading
2021-01-26 18:30:35 -06:00
Alex Gleason
e5c035a0ce
Fix mentions in compact html 2020-12-24 21:18:25 -06:00
Lain Soykaf
e0fd2e7620 LinkifyTest: Add test for short IPv4 bug. 2020-12-22 14:17:13 +01:00
Mark Felder
713b986fa5 Only support IPv4 for the moment 2020-12-21 11:32:05 -06:00
Mark Felder
26fec6cff1 Fix invalid IPv4 linking; optimize
thx @href !
2020-12-19 13:20:11 -06:00
Haelwenn
9b86e5e5e4 Merge branch 'features/hostname_validation' into 'master'
Add .onion in the default TLDs, Validate IPv6, IDN compatibility in email and mentions

See merge request pleroma/elixir-libraries/linkify!29
2020-11-19 20:42:20 +00:00
Mark Felder
9925f4514e Add .onion domain tests 2020-11-19 19:49:21 +00:00
Mark Felder
5573fe6d97 Test IDN and punycode domains in mentions 2020-11-19 19:30:20 +00:00
Mark Felder
3ce2c34709 Fix linking URLs/domains with trailing punctuation 2020-11-19 18:55:17 +00:00
Mark Felder
17126aa662 Move tests under correct group, add test for URLs with IPv4 for domain 2020-11-19 18:29:41 +00:00
Mark Felder
31d41920ed Fix test group name 2020-11-19 18:25:54 +00:00
Mark Felder
c14ac019af Add IDN and punycode domain test 2020-11-19 18:13:55 +00:00
Haelwenn (lanodan) Monnier
649fc9125d parser: Validate IPv6, IDN compatibility in email and mentions 2020-11-19 17:42:34 +00:00
Haelwenn (lanodan) Monnier
26f5310379 parser: Add onion as an extra TLD 2020-11-19 17:42:34 +00:00
Justin Tormey
d84ca4d0b7 Fix formatting in test 2020-11-19 09:48:28 -06:00
Justin Tormey
8713d4141a Add handle_href option for href pre-processing 2020-11-19 09:40:47 -06:00
Mark Felder
372879c8d4 Verify trailing periods as sentence punctuation do not link 2020-11-18 17:41:12 +00:00
Mark Felder
b87be206a7 Support URLs with FQDNs (trailing period on the tld) 2020-11-18 17:24:44 +00:00
Sergey Suprunenko
2a050e1cbe
Ignore non-word chars in the beginning of mentions 2020-11-16 23:03:24 +01:00
Sergey Suprunenko
e16136f709
Do not parse mention if there is something before it 2020-11-10 21:24:50 +01:00
Sergey Suprunenko
7005cda9e4
Handle punctuation marks and new lines 2020-10-06 21:49:00 +02:00
Sergey Suprunenko
74afaca73b
Handle punctuation marks and angle bracket in the end of a link 2020-10-06 21:43:35 +02:00
Sergey Suprunenko
e5a8cf2b08
Do not parse html links inside html tags 2020-10-06 21:43:04 +02:00
Sergey Suprunenko
69902de571
Handle hashtags followed by skipped html tags 2020-08-31 20:48:04 +02:00
Justin Tormey
1d52bfeb81 Fix formatting 2020-07-27 12:46:26 -05:00
Justin Tormey
b1f6c04eef Add parser support for iodata and safe iodata 2020-07-27 12:42:51 -05:00
Alex Gleason
7c6cff9f8c
Don't parse mentions inside links
Fixes: https://git.pleroma.social/pleroma/pleroma/-/issues/1656
2020-06-30 16:29:32 -05:00
Egor Kislitsyn
14b8f39160 Disable strip_prefix by default 2019-07-11 20:08:30 +07:00
Egor Kislitsyn
66f5165655 Do not add class, target and rel attributes by default 2019-06-27 15:32:07 +07:00
Egor Kislitsyn
2690f2b680 Rename to Linkify 2019-06-24 17:57:31 +07:00
Egor Kislitsyn
093d2344d2 Refactor parser
Refactor parser
2019-06-21 20:09:52 +07:00
Egor Kislitsyn
529014c8f4 Drop phone links support 2019-06-21 19:05:47 +07:00
Egor Kislitsyn
150d9f222f Remove scheme setting 2019-06-21 18:09:52 +07:00
Egor Kislitsyn
6242cebdf9 Use double quotes in HTML attributes 2019-06-21 17:24:30 +07:00
Egor Kislitsyn
f081e6b553 Remove markdown links support 2019-06-21 17:12:11 +07:00
rinpatch
70cbfdc84e Extend email? to utilize validate_tld 2019-06-18 13:25:44 +03:00
rinpatch
c19c7afa5b Refactor url?/2 to use opts 2019-06-18 12:57:31 +03:00
rinpatch
c8026cd16c Add an option to disable TLD validation
Added `validate_tld` option, which can be set to false to disable tld
validation and to :no_scheme to disable tld validation when a scheme is
present

Closes #8
2019-06-17 23:06:31 +03:00