diff --git a/CHANGELOG b/CHANGELOG index b401848477..70c26b518b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,9 @@ git-annex (10.20250103) UNRELEASED; urgency=medium * Avoid verification error when addurl --verifiable is used with an url claimed by a special remote other than the web. * Fix installation on Android. + * Allow enableremote of an existing webdav special remote that has + read-only access. + * git-remote-annex: Use enableremote rather than initremote. -- Joey Hess Fri, 03 Jan 2025 14:30:38 -0400 diff --git a/CmdLine/GitRemoteAnnex.hs b/CmdLine/GitRemoteAnnex.hs index ef1801dd94..da2a61b34b 100644 --- a/CmdLine/GitRemoteAnnex.hs +++ b/CmdLine/GitRemoteAnnex.hs @@ -586,14 +586,15 @@ withSpecialRemote cfg@(SpecialRemoteConfig {}) sab a = case specialRemoteName cf Nothing -> specialRemoteFromUrl sab inittempremote where -- Initialize a new special remote with the provided configuration - -- and name. + -- and name. This actually does a Remote.Enable, because the + -- special remote has already been initialized somewhere before. initremote remotename = do let c = M.insert SpecialRemote.nameField (Proposed remotename) $ M.delete (Accepted "config-uuid") $ specialRemoteConfig cfg t <- either giveup return (SpecialRemote.findType c) dummycfg <- liftIO dummyRemoteGitConfig - (c', u) <- Remote.setup t Remote.Init (Just (specialRemoteUUID cfg)) + (c', u) <- Remote.setup t (Remote.Enable c) (Just (specialRemoteUUID cfg)) Nothing c dummycfg `onException` cleanupremote remotename Logs.Remote.configSet u c' diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs index d9984d3387..aaf8b8f059 100644 --- a/Remote/WebDAV.hs +++ b/Remote/WebDAV.hs @@ -137,7 +137,9 @@ webdavSetup ss mu mcreds c gc = do (c', encsetup) <- encryptionSetup c gc pc <- either giveup return . parseRemoteConfig c' =<< configParser remote c' creds <- maybe (getCreds pc gc u) (return . Just) mcreds - testDav url creds + case ss of + Init -> testDav url creds + _ -> noop gitConfigSpecialRemote u c' [("webdav", "true")] c'' <- setRemoteCredPair ss encsetup pc gc (davCreds u) creds return (c'', u) diff --git a/doc/special_remotes/webdav/comment_24_6c16a7c9abb257be4d046e27e11bacdf._comment b/doc/special_remotes/webdav/comment_24_6c16a7c9abb257be4d046e27e11bacdf._comment index 094399f650..0b305c38a0 100644 --- a/doc/special_remotes/webdav/comment_24_6c16a7c9abb257be4d046e27e11bacdf._comment +++ b/doc/special_remotes/webdav/comment_24_6c16a7c9abb257be4d046e27e11bacdf._comment @@ -1,10 +1,9 @@ [[!comment format=mdwn username="joey" - subject="""comment 24""" - date="2023-06-20T17:25:27Z" + subject="""Re: read-only webdav access""" + date="2025-01-07T18:51:26Z" content=""" -httpalso now supports chunking. So I think there's no need to add readonly -support to webdav, probably. But if you disagree, I do think it would be -possible to add. Just probably not useful.. after all webdav minus writing -is little different than http. If you disagree, open a [[todo]]. +Update: Since I posted this comment, enableremote of an existing webdav +special remote has been made to work even if you cannot write to it. So +there is no need to use httpalso and no need for a readonly=true. """]] diff --git a/doc/todo/Read-only_support_for_webdav/comment_1_1fd87a5ab19a81a1b094efea7e70e581._comment b/doc/todo/Read-only_support_for_webdav/comment_1_1fd87a5ab19a81a1b094efea7e70e581._comment new file mode 100644 index 0000000000..063f08805b --- /dev/null +++ b/doc/todo/Read-only_support_for_webdav/comment_1_1fd87a5ab19a81a1b094efea7e70e581._comment @@ -0,0 +1,25 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2025-01-07T18:51:26Z" + content=""" +I'm not sure I'd trust an old comment of mine to reflect whether httpalso +supports http authentication. From what I can see, without trying it, it +will use git-credential to prompt for password when receiving a 401 +response, the same as all other parts of git-annex that download urls +do nowadays. + +Re git-remote-annex, I see your point though. Since it does set up the +remote when cloning, and webdav remote setup calls involves creating and +deleting a test file, the user needs write access currently. (Whether that +test file is worth it doing at all, I'm on the fence about. It seemed like +a good idea way back when.) + +I think that, rather than needing readonly=true, enableremote of a webdav +special remote should just assume it exists and not test write access to +it. Then it will work with readonly access. I've implemented that. + +And I've made git-remote-annex on git clone do an enableremote, rather than +an initremote. That should make it work with a readonly webdav special +remote. +"""]]