summaryrefslogtreecommitdiff
path: root/Remote/Web.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-08-06 14:45:58 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-08-06 14:45:58 -0400
commitdd8e649f49212c46df23f329299c64e13a3c90e1 (patch)
treeb64c5dc88f57b37e92a65419e1dc6b2ab49631c5 /Remote/Web.hs
parent3ffc0bb4f57e20350f59c0e331656e54877916aa (diff)
fix file name for web remote log files
The key name was not being sufficiently escaped, although it didn't break anything due to luck. Switch to properly escaped key names for the log filename, with a fallback to the buggy old name.
Diffstat (limited to 'Remote/Web.hs')
-rw-r--r--Remote/Web.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Remote/Web.hs b/Remote/Web.hs
index 2f8fac23b..cd028a06d 100644
--- a/Remote/Web.hs
+++ b/Remote/Web.hs
@@ -67,10 +67,17 @@ gen r _ _ =
{- The urls for a key are stored in remote/web/hash/key.log
- in the git-annex branch. -}
urlLog :: Key -> FilePath
-urlLog key = "remote/web" </> hashDirLower key </> show key ++ ".log"
+urlLog key = "remote/web" </> hashDirLower key </> keyFile key ++ ".log"
+oldurlLog :: Key -> FilePath
+{- A bug used to store the urls elsewhere. -}
+oldurlLog key = "remote/web" </> hashDirLower key </> show key ++ ".log"
getUrls :: Key -> Annex [URLString]
-getUrls key = currentLog (urlLog key)
+getUrls key = do
+ us <- currentLog (urlLog key)
+ if null us
+ then currentLog (oldurlLog key)
+ else return us
{- Records a change in an url for a key. -}
setUrl :: Key -> URLString -> LogStatus -> Annex ()