Web.checkKey: Fix handling of multiple urls

When there are multiple urls for a file, still treat it as being present
in the web when some urls don't work, as long as at least one url does
work.

This is consistent with the other web methods handling of multiple urls.

This commit was sponsored by Ole-Morten Duesund on Patreon.
This commit is contained in:
Joey Hess 2017-11-07 16:15:44 -04:00
parent c05570bd99
commit 9d129367db
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 16 additions and 2 deletions

View file

@ -3,6 +3,9 @@ git-annex (6.20171027) UNRELEASED; urgency=medium
* Fix export of subdir of a branch.
* Fix exporting of non-annexed files to external special remotes.
* unlock, lock: Support --json.
* When there are multiple urls for a file, still treat it as being present
in the web when some urls don't work, as long as at least one url does
work.
-- Joey Hess <id@joeyh.name> Mon, 30 Oct 2017 12:01:45 -0400

View file

@ -119,8 +119,8 @@ checkKey' key us = firsthit us (Right False) $ \u -> do
firsthit (u:rest) _ a = do
r <- a u
case r of
Right _ -> return r
Left _ -> firsthit rest r a
Right True -> return r
_ -> firsthit rest r a
getWebUrls :: Key -> Annex [URLString]
getWebUrls key = filter supported <$> getUrls key

View file

@ -60,3 +60,4 @@ I'm running NixOS btw.
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
I'm lovin' it!
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,10 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2017-11-07T19:58:14Z"
content="""
I think that the real bug here is that, as long as one url still has the
content, it's still present in the web, so should not be marked as not
present. The rest of the operations in the web special remote work that
way, trying urls until one succeeds, and so should `checkKey`.
"""]]