aboutsummaryrefslogtreecommitdiffstats
path: root/lib/parse/hyperlinks_test.go
Commit message (Collapse)AuthorAgeFilesLines
* open-link: make URL parsing more lenientMoritz Poldrack2022-09-131-22/+50
| | | | | | | | | | | | | | | | | | | | | | | | URLs are extremely loosely defined and can take many shapes which may not be parsed at all if unusual characters like the exclamation mark are present. To ensure lists and odd use of spaces are not parsed as links some sanity-checks are in place: - the URL's schema must be at least two characters long - the URL's authority, path, and fragment must have a combined length of 8 characters or longer - the URL must not contain a whitespace character, >, ), or " - the URL may only contain a ] when followed by a different allowed character or at the end of the line (necessary for IPv6 authorities) The tests for this function now include links with an exclamation point and IPv6 addresses. The tests are given names to be easier identifiable. Link: https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml Reported-by: "Bence Ferdinandy" <bence@ferdinandy.com> Cc: "Koni Marti" <koni.marti@gmail.com> Fixes: e1d8bc4d17cb ("msgviewer: open http links from messages") Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
* go: removed io/ioutilMoritz Poldrack2022-08-221-2/+2
| | | | | | | | | | Since the minimum required version of Go has been bumped to 1.16, the deprecation of io/ioutil can now be acted upon. This Commit removes the remaining dependencies on ioutil and replaces them with their io or os counterparts. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
* msgviewer: open http links from messagesKoni Marti2022-06-141-0/+99
Parse http links from a message and display them as completions in the :open-link command. Add the following binds to the [view] section in your binds.conf: <C-l> = :open-link <space> Parsing can be disabled in aerc.conf by setting parse-http-links to false in the viewer section. Thanks to Moritz for the help with the regular expression. Signed-off-by: Koni Marti <koni.marti@gmail.com> Reviewed-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>