From dd8e649f49212c46df23f329299c64e13a3c90e1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 6 Aug 2011 14:45:58 -0400 Subject: 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. --- Remote/Web.hs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Remote') 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 () -- cgit v1.2.3