diff options
Diffstat (limited to 'Annex/Link.hs')
-rw-r--r-- | Annex/Link.hs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Annex/Link.hs b/Annex/Link.hs index 30d8c2ae8..234e4cb2a 100644 --- a/Annex/Link.hs +++ b/Annex/Link.hs @@ -51,19 +51,15 @@ getAnnexLinkTarget file = ifM (coreSymlinks <$> Annex.getGitConfig) | otherwise -> return Nothing Nothing -> fallback - probefilecontent f = do - h <- openFile f ReadMode + probefilecontent f = withFile f ReadMode $ \h -> do fileEncoding h -- The first 8k is more than enough to read; link -- files are small. s <- take 8192 <$> hGetContents h -- If we got the full 8k, the file is too large if length s == 8192 - then do - hClose h - return "" - else do - hClose h + then return "" + else -- If there are any NUL or newline -- characters, or whitespace, we -- certianly don't have a link to a |