diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-12-17 21:36:55 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-12-17 21:36:55 +0100 |
commit | 58e1cf274e80d8dbd4889bb2c99d3a009b590282 (patch) | |
tree | 7facbcc908ac9751a0ae187bf51355b51cd3f83d | |
parent | ea241da2457aa9992cad7d64796d1ef40b0264b0 (diff) |
restrict `listFiles` to paths
-rw-r--r-- | src/Store/Store.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Store/Store.hs b/src/Store/Store.hs index 59a3ebf..134c8c3 100644 --- a/src/Store/Store.hs +++ b/src/Store/Store.hs @@ -32,7 +32,7 @@ import Data.Time.Clock (getCurrentTime) import Foreign import Git qualified as G import Git.Libgit2 qualified as GB -import System.FilePath (makeRelative, normalise, (</>)) +import System.FilePath (addTrailingPathSeparator, makeRelative, normalise, (</>)) import Text.Printf (printf) import Prelude hiding (readFile, writeFile) @@ -92,7 +92,7 @@ withCommit cid action = do (Env {repo, ref}) listFiles :: FilePath -> StoreM [FilePath] -listFiles (normalise . ("/" </>) -> fp) = do +listFiles (normalise . ("/" </>) . addTrailingPathSeparator -> fp) = do State {tid} <- get map (makeRelative fp) . filter (fp `isPrefixOf`) |