From 2cb444f250627c787f73fc294ad53e9ed7bd6b49 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Mon, 1 Apr 2013 17:31:13 +0200 Subject: Fix issue where: hasProtocol "foo" == True See #129 --- src/Hakyll/Check.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Hakyll/Check.hs b/src/Hakyll/Check.hs index 10e7df0..6d75e2e 100644 --- a/src/Hakyll/Check.hs +++ b/src/Hakyll/Check.hs @@ -141,13 +141,17 @@ checkUrl filePath url | hasProtocol url = skip "Unknown protocol, skipping" | otherwise = checkInternalUrl filePath url where - hasProtocol = all (`elem` validProtoChars) . takeWhile (/= ':') validProtoChars = ['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9'] ++ "+-." + hasProtocol str = case break (== ':') str of + (proto, ':' : _) -> all (`elem` validProtoChars) proto + _ -> False + -------------------------------------------------------------------------------- ok :: String -> Checker () ok _ = tell $ mempty {checkerOk = 1} + -------------------------------------------------------------------------------- skip :: String -> Checker () skip reason = do -- cgit v1.2.3