unregisterurl: remove all forms of an url, no matter what the downloader is set to

unregisterurl: Fix a bug that caused an url to not be unregistered when it
is claimed by a special remote other than the web.

See commit f175d4cc90 for rationalle.
This commit is contained in:
Joey Hess 2021-03-22 12:17:17 -04:00
parent c984d248d2
commit 0af9d1dcb6
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 13 additions and 2 deletions

View file

@ -12,6 +12,8 @@ git-annex (8.20210311) UNRELEASED; urgency=medium
prefixed with "yt:" in order to be removed.
* rmurl: If an url is both used by the web and also claimed by another
special remote, fix a bug that caused the url to to not be removed.
* unregisterurl: Fix a bug that caused an url to not be unregistered
when it is claimed by a special remote other than the web.
-- Joey Hess <id@joeyh.name> Fri, 12 Mar 2021 12:06:37 -0400

View file

@ -21,5 +21,14 @@ cmd = command "unregisterurl"
seek :: RegisterUrlOptions -> CommandSeek
seek o = case (batchOption o, keyUrlPairs o) of
(Batch fmt, _) -> commandAction $ startMass setUrlMissing fmt
(NoBatch, ps) -> withWords (commandAction . start setUrlMissing) ps
(Batch fmt, _) -> commandAction $ startMass unregisterUrl fmt
(NoBatch, ps) -> withWords (commandAction . start unregisterUrl) ps
unregisterUrl :: Key -> String -> Annex ()
unregisterUrl key url = do
-- Remove the url no matter what downloader;
-- registerurl can set OtherDownloader, and this should also
-- be able to remove urls added by addurl, which may use
-- YoutubeDownloader.
forM_ [minBound..maxBound] $ \dl ->
setUrlMissing key (setDownloader url dl)