aboutsummaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2014-12-11 20:08:49 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2014-12-11 20:08:49 -0400
commit892eac7f77f0e54fc8003ca9e306a76d59ebc519 (patch)
treeb2a5e59b98769e8e9a0945ae947d69ae1657004a /Command
parentfe0fdf3b49840c19f0c2294fd958e5ed6448a827 (diff)
sanitize filepaths provided by checkUrl
Diffstat (limited to 'Command')
-rw-r--r--Command/AddUrl.hs4
-rw-r--r--Command/ImportFeed.hs2
2 files changed, 3 insertions, 3 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index 22e996a15..825d9bdbf 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -73,11 +73,11 @@ seek us = do
next $ next $ return False
Right (UrlContents sz mf) -> do
void $ commandAction $
- startRemote r relaxed (fromMaybe deffile mf) u sz
+ startRemote r relaxed (maybe deffile fromSafeFilePath mf) u sz
Right (UrlMulti l) ->
forM_ l $ \(u', sz, f) ->
void $ commandAction $
- startRemote r relaxed (deffile </> f) u' sz
+ startRemote r relaxed (deffile </> fromSafeFilePath f) u' sz
startRemote :: Remote -> Bool -> FilePath -> URLString -> Maybe Integer -> CommandStart
startRemote r relaxed file uri sz = do
diff --git a/Command/ImportFeed.hs b/Command/ImportFeed.hs
index a34052110..d827d549f 100644
--- a/Command/ImportFeed.hs
+++ b/Command/ImportFeed.hs
@@ -156,7 +156,7 @@ performDownload relaxed cache todownload = case location todownload of
downloadRemoteFile r relaxed url f sz
Right (UrlMulti l) -> do
kl <- forM l $ \(url', sz, subf) ->
- downloadRemoteFile r relaxed url' (f </> subf) sz
+ downloadRemoteFile r relaxed url' (f </> fromSafeFilePath subf) sz
return $ if all isJust kl
then catMaybes kl
else []