sanitize filepaths provided by checkUrl
This commit is contained in:
parent
b0ca0985ce
commit
67c05daf5e
5 changed files with 41 additions and 10 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue