diff options
author | Joey Hess <joeyh@joeyh.name> | 2014-12-11 20:08:49 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2014-12-11 20:08:49 -0400 |
commit | 892eac7f77f0e54fc8003ca9e306a76d59ebc519 (patch) | |
tree | b2a5e59b98769e8e9a0945ae947d69ae1657004a /Remote | |
parent | fe0fdf3b49840c19f0c2294fd958e5ed6448a827 (diff) |
sanitize filepaths provided by checkUrl
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/External.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Remote/External.hs b/Remote/External.hs index 7e2b2d0b0..47220c23c 100644 --- a/Remote/External.hs +++ b/Remote/External.hs @@ -434,12 +434,14 @@ checkurl :: External -> URLString -> Annex UrlContents checkurl external url = handleRequest external (CHECKURL url) Nothing $ \req -> case req of CHECKURL_CONTENTS sz f -> Just $ return $ UrlContents sz - (if null f then Nothing else Just f) + (if null f then Nothing else Just $ mkSafeFilePath f) -- Treat a single item multi response specially to -- simplify the external remote implementation. CHECKURL_MULTI ((_, sz, f):[]) -> - Just $ return $ UrlContents sz (Just f) - CHECKURL_MULTI l -> Just $ return $ UrlMulti l + Just $ return $ UrlContents sz $ Just $ mkSafeFilePath f + CHECKURL_MULTI l -> Just $ return $ UrlMulti $ map mkmulti l CHECKURL_FAILURE errmsg -> Just $ error errmsg UNSUPPORTED_REQUEST -> error "CHECKURL not implemented by external special remote" _ -> Nothing + where + mkmulti (u, s, f) = (u, s, mkSafeFilePath f) |