~alcinnz/hurl

9794e7d56e818c566264c7c9a806912e7943767e — Adrian Cochrane 3 years ago 70b80f7
Ensure parsed rewriters are actually files.
1 files changed, 7 insertions(+), 4 deletions(-)

M src/Network/URI/PlugIns/Rewriters.hs
M src/Network/URI/PlugIns/Rewriters.hs => src/Network/URI/PlugIns/Rewriters.hs +7 -4
@@ 38,10 38,13 @@ parseRewriters app = do
    loadRewriters dir = do
        files <- Dir.listDirectory dir
        raw <- forConcurrently files $ \file -> do
            rewriter <- parseRewriter file
            return $ case rewriter of
                Select x -> x
                Pipe x -> x
            exists <- doesFileExist file
            if exists then do
                rewriter <- parseRewriter file
                return $ case rewriter of
                    Select x -> x
                    Pipe x -> x
            else return []
        return $ concat raw

applyRewriter :: Rewriter -> URI -> Maybe URI