Skip to content

Commit

Permalink
fixup! fixup! [#25] Redirect links with configuration rules
Browse files Browse the repository at this point in the history
  • Loading branch information
aeqz committed Dec 29, 2022
1 parent 521a44b commit 8da9d37
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Xrefcheck/Verify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ checkExternalResource :: [Text] -> Config -> Text -> IO (VerifyResult VerifyErro
checkExternalResource followed config@Config{..} link
| isIgnored = return mempty
| otherwise = fmap toVerifyRes $ runExceptT $ do
when (link `elem` followed) $ throwError $ RedirectCycle (link : followed)
uri <- parseUri link
case toString <$> uriScheme uri of
Just "http" -> checkHttp uri
Expand Down Expand Up @@ -723,10 +724,8 @@ checkExternalResource followed config@Config{..} link
Nothing -> throwError $ ExternalResourceSomeError "Response timeout"
Just RRDone -> pure ()
Just (RRFollow nextLink) -> do
when (nextLink `elem` followed) $
throwError $ RedirectCycle (nextLink : followed)
(VerifyResult errs) <- liftIO $
checkExternalResource (nextLink : followed) config nextLink
checkExternalResource (link : followed) config nextLink
mapM_ throwError errs

isAllowedErrorCode :: Int -> Bool
Expand Down

0 comments on commit 8da9d37

Please sign in to comment.