summaryrefslogtreecommitdiff
path: root/Command/AddUrl.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-07-05 12:46:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-07-05 12:46:38 -0400
commit0878f9051291c5035c3c0ab3beefab4871410ed4 (patch)
treeb0f8f299d18ef4b9eb110c62cfdaef9282b4b40e /Command/AddUrl.hs
parentfdd1a7beea7fca2e7ec253a943e414555af85dca (diff)
addurl --pathdepth: Fix failure when the pathdepth specified is deeper than the urls's path.
Diffstat (limited to 'Command/AddUrl.hs')
-rw-r--r--Command/AddUrl.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs
index c4062068a..f45d00cc6 100644
--- a/Command/AddUrl.hs
+++ b/Command/AddUrl.hs
@@ -151,6 +151,7 @@ url2file :: URI -> Maybe Int -> FilePath
url2file url pathdepth = case pathdepth of
Nothing -> filesize $ escape fullurl
Just depth
+ | depth >= length urlbits -> frombits id
| depth > 0 -> frombits $ drop depth
| depth < 0 -> frombits $ reverse . take (negate depth) . reverse
| otherwise -> error "bad --pathdepth"