diff --git a/Assistant/WebApp/Configurators/Delete.hs b/Assistant/WebApp/Configurators/Delete.hs index 4a28cd3474..e7c5313636 100644 --- a/Assistant/WebApp/Configurators/Delete.hs +++ b/Assistant/WebApp/Configurators/Delete.hs @@ -22,6 +22,7 @@ import Logs.Trust import Logs.Remote import Logs.PreferredContent import Types.StandardGroups +import Annex.UUID import System.IO.HVFS (SystemFS(..)) import qualified Data.Text as T @@ -29,9 +30,13 @@ import qualified Data.Map as M import System.Path notCurrentRepo :: UUID -> Handler Html -> Handler Html -notCurrentRepo uuid a = go =<< liftAnnex (Remote.remoteFromUUID uuid) +notCurrentRepo uuid a = do + u <- liftAnnex getUUID + if u == uuid + then redirect DeleteCurrentRepositoryR + else go =<< liftAnnex (Remote.remoteFromUUID uuid) where - go Nothing = redirect DeleteCurrentRepositoryR + go Nothing = error "Unknown UUID" go (Just _) = a getDisableRepositoryR :: UUID -> Handler Html diff --git a/Remote.hs b/Remote.hs index 0638e65b06..8b88a75d99 100644 --- a/Remote.hs +++ b/Remote.hs @@ -168,13 +168,19 @@ prettyListUUIDs uuids = do prettyUUID :: UUID -> Annex String prettyUUID u = concat <$> prettyListUUIDs [u] -{- Gets the remote associated with a UUID. - - There's no associated remote when this is the UUID of the local repo. -} +{- Gets the remote associated with a UUID. -} remoteFromUUID :: UUID -> Annex (Maybe Remote) remoteFromUUID u = ifM ((==) u <$> getUUID) ( return Nothing - , Just . fromMaybe (error "Unknown UUID") . M.lookup u <$> remoteMap id + , do + maybe tryharder (return . Just) =<< findinmap ) + where + findinmap = M.lookup u <$> remoteMap id + {- Re-read remote list in case a new remote has popped up. -} + tryharder = do + void remoteListRefresh + findinmap {- Filters a list of remotes to ones that have the listed uuids. -} remotesWithUUID :: [Remote] -> [UUID] -> [Remote] diff --git a/debian/changelog b/debian/changelog index 1379ffc018..9fbeae0a74 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,9 @@ git-annex (4.20130921) UNRELEASED; urgency=low * Send a git-annex user-agent when downloading urls. Overridable with --user-agent option. (Not yet done for S3 or WebDAV due to limitations of libraries used.) + * webapp: Fixed a bug where when a new remote is added, one file + may fail to sync to or from it due to the transferrer process not + yet knowing about the new remote. -- Joey Hess Sun, 22 Sep 2013 19:42:29 -0400