summaryrefslogtreecommitdiff
path: root/Command/RegisterUrl.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-19 15:46:32 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-19 15:46:32 -0400
commitfccc38249549e7471bceb4e9859e3beb2642217d (patch)
treeaaaaf3db76de8d78037e5b360c709c4df682d2cd /Command/RegisterUrl.hs
parent1c3c3180dea70b9405ebcbfe93d6f70f8fd2b89b (diff)
registerurl: Check if a remote claims the url, same as addurl does.
Diffstat (limited to 'Command/RegisterUrl.hs')
-rw-r--r--Command/RegisterUrl.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/Command/RegisterUrl.hs b/Command/RegisterUrl.hs
index 16489c094..c1f5a2fcd 100644
--- a/Command/RegisterUrl.hs
+++ b/Command/RegisterUrl.hs
@@ -14,6 +14,7 @@ import Command
import Logs.Web
import Annex.UUID
import Command.FromKey (mkKey)
+import qualified Remote
cmd :: Command
cmd = notDirect $ notBareRepo $
@@ -53,5 +54,9 @@ perform key url = do
perform' :: Key -> URLString -> Annex Bool
perform' key url = do
- setUrlPresent webUUID key url
+ r <- Remote.claimingUrl url
+ let url' = if Remote.uuid r == webUUID
+ then url
+ else setDownloader url OtherDownloader
+ setUrlPresent (Remote.uuid r) key url'
return True