summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-11-07 16:15:44 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-11-07 16:15:44 -0400
commitf3af50df049cf3d75e3d0983979bfcedd8192ef1 (patch)
treebf940c1507f0c4d2b7d7d175d80f4ec298c3b5d5
parentbc92cb5a599865efc79f38044c56cbf67143c2c7 (diff)
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.
-rw-r--r--CHANGELOG3
-rw-r--r--Remote/Web.hs4
-rw-r--r--doc/bugs/git_annex_fsck_--from_web_removes_all_urls_of_a_file.mdwn1
-rw-r--r--doc/bugs/git_annex_fsck_--from_web_removes_all_urls_of_a_file/comment_1_e1503374a87da976c831cd7fa0749e58._comment10
4 files changed, 16 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 06480e1ec..868db42af 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
diff --git a/Remote/Web.hs b/Remote/Web.hs
index f3580ca99..233c17eb3 100644
--- a/Remote/Web.hs
+++ b/Remote/Web.hs
@@ -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
diff --git a/doc/bugs/git_annex_fsck_--from_web_removes_all_urls_of_a_file.mdwn b/doc/bugs/git_annex_fsck_--from_web_removes_all_urls_of_a_file.mdwn
index 70bb8d06d..0e6f5d256 100644
--- a/doc/bugs/git_annex_fsck_--from_web_removes_all_urls_of_a_file.mdwn
+++ b/doc/bugs/git_annex_fsck_--from_web_removes_all_urls_of_a_file.mdwn
@@ -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]]
diff --git a/doc/bugs/git_annex_fsck_--from_web_removes_all_urls_of_a_file/comment_1_e1503374a87da976c831cd7fa0749e58._comment b/doc/bugs/git_annex_fsck_--from_web_removes_all_urls_of_a_file/comment_1_e1503374a87da976c831cd7fa0749e58._comment
new file mode 100644
index 000000000..6c6957f60
--- /dev/null
+++ b/doc/bugs/git_annex_fsck_--from_web_removes_all_urls_of_a_file/comment_1_e1503374a87da976c831cd7fa0749e58._comment
@@ -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`.
+"""]]