diff options
author | Joey Hess <joeyh@joeyh.name> | 2014-12-11 12:47:57 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2014-12-11 12:47:57 -0400 |
commit | bc0bf97b20c48e1d1a35d25e2e76a311c102438c (patch) | |
tree | 05934001ff6b3060cb477a1bd017316827eb050b /Remote | |
parent | 7f5e752b41b559bce358a9d6a053a7b195706e80 (diff) |
let url claims optionally include a suggested filename
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/External.hs | 10 | ||||
-rw-r--r-- | Remote/External/Types.hs | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/Remote/External.hs b/Remote/External.hs index 62671755c..baae1ab9d 100644 --- a/Remote/External.hs +++ b/Remote/External.hs @@ -12,6 +12,7 @@ import qualified Annex import Common.Annex import Types.Remote import Types.CleanupActions +import Types.URLClaim import qualified Git import Config import Remote.Helper.Special @@ -421,12 +422,13 @@ getAvailability external r gc = maybe query return (remoteAnnexAvailability gc) setRemoteAvailability r avail return avail -claimurl :: External -> URLString -> Annex Bool +claimurl :: External -> URLString -> Annex (Maybe URLClaim) claimurl external url = handleRequest external (CLAIMURL url) Nothing $ \req -> case req of - CLAIMURL_SUCCESS -> Just $ return True - CLAIMURL_FAILURE -> Just $ return False - UNSUPPORTED_REQUEST -> Just $ return False + CLAIMURL_SUCCESS -> Just $ return $ Just URLClaimed + (CLAIMURL_AS f) -> Just $ return $ Just $ URLClaimedAs f + CLAIMURL_FAILURE -> Just $ return Nothing + UNSUPPORTED_REQUEST -> Just $ return Nothing _ -> Nothing checkurl :: External -> URLString -> Annex (Maybe Integer) diff --git a/Remote/External/Types.hs b/Remote/External/Types.hs index b00352702..a230ef3d2 100644 --- a/Remote/External/Types.hs +++ b/Remote/External/Types.hs @@ -136,6 +136,7 @@ data Response | INITREMOTE_SUCCESS | INITREMOTE_FAILURE ErrorMsg | CLAIMURL_SUCCESS + | CLAIMURL_AS FilePath | CLAIMURL_FAILURE | CHECKURL_SIZE Size | CHECKURL_SIZEUNKNOWN @@ -158,6 +159,7 @@ instance Proto.Receivable Response where parseCommand "INITREMOTE-SUCCESS" = Proto.parse0 INITREMOTE_SUCCESS parseCommand "INITREMOTE-FAILURE" = Proto.parse1 INITREMOTE_FAILURE parseCommand "CLAIMURL-SUCCESS" = Proto.parse0 CLAIMURL_SUCCESS + parseCommand "CLAIMURL-AS" = Proto.parse1 CLAIMURL_AS parseCommand "CLAIMURL-FAILURE" = Proto.parse0 CLAIMURL_FAILURE parseCommand "CHECKURL-SIZE" = Proto.parse1 CHECKURL_SIZE parseCommand "CHECKURL-SIZEUNKNOWN" = Proto.parse0 CHECKURL_SIZEUNKNOWN |