From 7117376e44c7f57d0b5dedf23c7abad807155456 Mon Sep 17 00:00:00 2001 From: cytopia Date: Tue, 31 Jul 2018 08:25:55 +0200 Subject: [PATCH] Fix #11 Sanitize trailing parentheses --- linkcheck | 4 ++-- tests/urls.txt | 33 ++++++++++++++++----------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/linkcheck b/linkcheck index befd1e3..d0dcffd 100755 --- a/linkcheck +++ b/linkcheck @@ -57,7 +57,7 @@ STATUS_CODES=200 ### URL_REGEX="http(s)?:\\/\\/[-+%=?&():,._/#0-9a-zA-Z]+" -MY_VERSION="v0.5" +MY_VERSION="v0.6" ############################################################ @@ -144,7 +144,7 @@ setval() { ### sanitize_url() { local url="${1}" - local invalid="[,.!]$" + local invalid="[,.!\)]$" # Remove any trailing garbage while [[ ${url} =~ ${invalid} ]]; do diff --git a/tests/urls.txt b/tests/urls.txt index 408723b..b7726e8 100644 --- a/tests/urls.txt +++ b/tests/urls.txt @@ -1,5 +1,4 @@ # Plain URLs -https://nierautomata.wiki.fextralife.com/How+To+Unlock+the+Secret+Trophy+Shop https://nierautomata.wiki.fextralife.com/Locked+Chests https://www.baka-tsuki.org/project/?title=Ore_no_Im%C5%8Dto_ga_Konna_ni_Kawaii_Wake_ga_Nai https://www.phoronix.com/scan.php?page=news_item&px=U2-NVMe-PCI-E-SSD-Adapter @@ -7,41 +6,41 @@ https://en.wikipedia.org/w/index.php?title=Erlang_(programming_language)&diff=84 https://en.wiktionary.org/wiki/%E8%8C%B6 # Single Quoted URLs -'https://nierautomata.wiki.fextralife.com/How+To+Unlock+the+Secret+Trophy+Shop' -'https://nierautomata.wiki.fextralife.com/Locked+Chests' -'https://www.baka-tsuki.org/project/?title=Ore_no_Im%C5%8Dto_ga_Konna_ni_Kawaii_Wake_ga_Nai' 'https://www.phoronix.com/scan.php?page=news_item&px=U2-NVMe-PCI-E-SSD-Adapter' 'https://en.wikipedia.org/w/index.php?title=Erlang_(programming_language)&diff=847224766&oldid=847107459' 'https://en.wiktionary.org/wiki/%E8%8C%B6' # Double Quoted URLs -"https://nierautomata.wiki.fextralife.com/How+To+Unlock+the+Secret+Trophy+Shop" -"https://nierautomata.wiki.fextralife.com/Locked+Chests" -"https://www.baka-tsuki.org/project/?title=Ore_no_Im%C5%8Dto_ga_Konna_ni_Kawaii_Wake_ga_Nai" "https://www.phoronix.com/scan.php?page=news_item&px=U2-NVMe-PCI-E-SSD-Adapter" "https://en.wikipedia.org/w/index.php?title=Erlang_(programming_language)&diff=847224766&oldid=847107459" "https://en.wiktionary.org/wiki/%E8%8C%B6" # Bracketed URLs - - - - +> + +# Round Bracketed URLs +