From 199f34e42e78ca97f154a4880b77b3f1d01fa9da Mon Sep 17 00:00:00 2001 From: Frédéric Mangano-Tarumi Date: Sat, 1 Feb 2020 19:07:41 +0100 Subject: rendercomment: safer auto-linkification of URLs Fixes a few edge cases: - URLs within code blocks used to get redundant <> added, breaking bash code snippets like `curl https://...` into `curl `. - Links written with markdown's syntax also used to get an extra pair of brackets. Signed-off-by: Lukas Fleischer --- test/t2600-rendercomment.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'test/t2600-rendercomment.sh') diff --git a/test/t2600-rendercomment.sh b/test/t2600-rendercomment.sh index 7b3a4a8d..b0209eb5 100755 --- a/test/t2600-rendercomment.sh +++ b/test/t2600-rendercomment.sh @@ -51,11 +51,22 @@ test_expect_success 'Test HTML sanitizing.' ' test_expect_success 'Test link conversion.' ' cat <<-EOD | sqlite3 aur.db && - INSERT INTO PackageComments (ID, PackageBaseID, Comments, RenderedComment) VALUES (4, 1, "Visit https://www.archlinux.org/.", ""); + INSERT INTO PackageComments (ID, PackageBaseID, Comments, RenderedComment) VALUES (4, 1, " + Visit https://www.archlinux.org/. + Visit . + Visit \`https://www.archlinux.org/\`. + Visit [Arch Linux](https://www.archlinux.org/). + Visit [Arch Linux][arch]. + [arch]: https://www.archlinux.org/ + ", ""); EOD "$RENDERCOMMENT" 4 && cat <<-EOD >expected && -

Visit https://www.archlinux.org/.

+

Visit https://www.archlinux.org/. + Visit https://www.archlinux.org/. + Visit https://www.archlinux.org/. + Visit Arch Linux. + Visit Arch Linux.

EOD cat <<-EOD | sqlite3 aur.db >actual && SELECT RenderedComment FROM PackageComments WHERE ID = 4; -- cgit v1.2.3-24-g4f1b