@@ -23,7 +23,7 @@ import Control.Exception (SomeException, try)
2323import qualified Network.Wai as W
2424import WaiAppStatic.Listing
2525import Network.Mime
26−import System.PosixCompat.Files (fileSize, getFileStatus, modificationTime)
26+import System.PosixCompat.Files (fileSize, getFileStatus, modificationTime, isRegularFile)
2727import Data.Maybe (catMaybes)
2828import qualified Crypto.Conduit
2929import Data.Serialize (encode)
@@ -89,13 +89,14 @@ fileHelper hashFunc fp name = do
8989 efs <- try $ getFileStatus $ F.encodeString fp
9090 case efs of
9191 Left (_ :: SomeException) -> return Nothing
92− Right fs -> return $ Just File
92+ Right fs | isRegularFile fs -> return $ Just File
9393 { fileGetSize = fromIntegral $ fileSize fs
9494 , fileToResponse = \s h -> W.ResponseFile s h (F.encodeString fp) Nothing
9595 , fileName = name
9696 , fileGetHash = hashFunc fp
9797 , fileGetModified = Just $ modificationTime fs
9898 }
99+ Right _ -> return Nothing
99100
100101-- | How to calculate etags. Can perform filesystem reads on each call, or use
101102-- some caching mechanism.