summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2013-04-01 17:31:13 +0200
committerJasper Van der Jeugt <m@jaspervdj.be>2013-04-01 17:31:13 +0200
commit2cb444f250627c787f73fc294ad53e9ed7bd6b49 (patch)
tree362babc111398bc3dd546ae6fd2901d44cf764a4
parent571ab4b8f77997340a3d18fca3eaf7d4b79da83b (diff)
downloadhakyll-2cb444f250627c787f73fc294ad53e9ed7bd6b49.tar.gz
Fix issue where: hasProtocol "foo" == True
See #129
-rw-r--r--src/Hakyll/Check.hs6
1 files changed, 5 insertions, 1 deletions
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