Fix issue where: hasProtocol "foo" == True

See #129
This commit is contained in:
Jasper Van der Jeugt 2013-04-01 17:31:13 +02:00
parent 571ab4b8f7
commit 2cb444f250

View file

@ -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