summaryrefslogtreecommitdiff
path: root/Command/AddUrl.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-10-05 13:32:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-10-05 13:32:42 -0400
commit94697aaf725c50551ff91fa601fd7914a2fd5039 (patch)
treeb18b221de37e83cf1ad05f0334c4db1a44ff3009 /Command/AddUrl.hs
parente8fcc7fbc9082e84713c4c5cac688623038a130d (diff)
honor fileNameLengthLimit for quvi
Diffstat (limited to 'Command/AddUrl.hs')
-rw-r--r--Command/AddUrl.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index 2379857dc..b90297f27 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -83,7 +83,8 @@ start relaxed optfile pathdepth s = go $ fromMaybe bad $ parseURI s
page <- fromMaybe badquvi
<$> withQuviOptions Quvi.forceQuery [Quvi.quiet, Quvi.httponly] s'
let link = fromMaybe badquvi $ headMaybe $ Quvi.pageLinks page
- let file = choosefile $ sanitizeFilePath $
+ pathmax <- liftIO $ fileNameLengthLimit "."
+ let file = choosefile $ truncateFilePath pathmax $ sanitizeFilePath $
Quvi.pageTitle page ++ "." ++ Quvi.linkSuffix link
showStart "addurl" file
next $ performQuvi relaxed s' (Quvi.linkUrl link) file
@@ -214,7 +215,7 @@ nodownload relaxed url file = do
url2file :: URI -> Maybe Int -> Int -> FilePath
url2file url pathdepth pathmax = case pathdepth of
- Nothing -> truncateFilePath pathmax $ escape fullurl
+ Nothing -> truncateFilePath pathmax $ sanitizeFilePath fullurl
Just depth
| depth >= length urlbits -> frombits id
| depth > 0 -> frombits $ drop depth