on master help sign in
Fix issue where: hasProtocol "foo" == True
2cb444fJasper Van der Jeugt
src/Hakyll/Check.hs+5−1
@@ -141,13 +141,17 @@ checkUrl filePath url
141 | hasProtocol url = skip "Unknown protocol, skipping"
141 | hasProtocol url = skip "Unknown protocol, skipping"
142 | otherwise = checkInternalUrl filePath url
142 | otherwise = checkInternalUrl filePath url
143 where
143 where
144− hasProtocol = all (`elem` validProtoChars) . takeWhile (/= ':')
145 validProtoChars = ['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9'] ++ "+-."
144 validProtoChars = ['A'..'Z'] ++ ['a'..'z'] ++ ['0'..'9'] ++ "+-."
145+ hasProtocol str = case break (== ':') str of
146+ (proto, ':' : _) -> all (`elem` validProtoChars) proto
147+ _ -> False
148+
146
149
147--------------------------------------------------------------------------------
150--------------------------------------------------------------------------------
148ok :: String -> Checker ()
151ok :: String -> Checker ()
149ok _ = tell $ mempty {checkerOk = 1}
152ok _ = tell $ mempty {checkerOk = 1}
150
153
154+
151--------------------------------------------------------------------------------
155--------------------------------------------------------------------------------
152skip :: String -> Checker ()
156skip :: String -> Checker ()
153skip reason = do
157skip reason = do