diff options
-rw-r--r-- | Command/RegisterUrl.hs | 5 | ||||
-rw-r--r-- | Command/RmUrl.hs | 5 | ||||
-rw-r--r-- | Logs/Web.hs | 8 |
3 files changed, 10 insertions, 8 deletions
diff --git a/Command/RegisterUrl.hs b/Command/RegisterUrl.hs index c1f5a2fcd..8e86bcaa2 100644 --- a/Command/RegisterUrl.hs +++ b/Command/RegisterUrl.hs @@ -55,8 +55,5 @@ perform key url = do perform' :: Key -> URLString -> Annex Bool perform' key url = do r <- Remote.claimingUrl url - let url' = if Remote.uuid r == webUUID - then url - else setDownloader url OtherDownloader - setUrlPresent (Remote.uuid r) key url' + setUrlPresent (Remote.uuid r) key (setDownloader' url r) return True diff --git a/Command/RmUrl.hs b/Command/RmUrl.hs index d7e99587f..2ee8f2025 100644 --- a/Command/RmUrl.hs +++ b/Command/RmUrl.hs @@ -31,8 +31,5 @@ start (file, url) = flip whenAnnexed file $ \_ key -> do cleanup :: String -> Key -> CommandCleanup cleanup url key = do r <- Remote.claimingUrl url - let url' = if Remote.uuid r == webUUID - then url - else setDownloader url OtherDownloader - setUrlMissing (Remote.uuid r) key url' + setUrlMissing (Remote.uuid r) key (setDownloader' url r) return True diff --git a/Logs/Web.hs b/Logs/Web.hs index 6c1e6d135..8e737893e 100644 --- a/Logs/Web.hs +++ b/Logs/Web.hs @@ -15,6 +15,7 @@ module Logs.Web ( Downloader(..), getDownloader, setDownloader, + setDownloader', setTempUrl, removeTempUrl, ) where @@ -32,6 +33,8 @@ import Annex.CatFile import qualified Git import qualified Git.LsFiles import Utility.Url +import Annex.UUID +import qualified Types.Remote as Remote {- Gets all urls that a key might be available from. -} getUrls :: Key -> Annex [URLString] @@ -108,6 +111,11 @@ setDownloader u WebDownloader = u setDownloader u QuviDownloader = "quvi:" ++ u setDownloader u OtherDownloader = ":" ++ u +setDownloader' :: URLString -> Remote -> String +setDownloader' u r + | Remote.uuid r == webUUID = setDownloader u WebDownloader + | otherwise = setDownloader u OtherDownloader + getDownloader :: URLString -> (URLString, Downloader) getDownloader u = case separate (== ':') u of ("quvi", u') -> (u', QuviDownloader) |