From b808774908f95e8234ff8b57d5cfcb6deecf4548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Kl=C3=B6tzke?= Date: Mon, 1 Jul 2024 22:21:33 +0200 Subject: [PATCH] archive: fix MKCOL WebDAV method The MKCOL method creates collections. Those should have a trailing slash in their path name. Otherwise Apache might send a HTTP 301. Nginx refuses to create the directory with a 409 which looks odd. In any case, play safe and always use a trailing slash. --- pym/bob/archive.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pym/bob/archive.py b/pym/bob/archive.py index fb645671..fea7eb37 100644 --- a/pym/bob/archive.py +++ b/pym/bob/archive.py @@ -899,6 +899,11 @@ def __makeParentDirs(self, url, depth=0): raise ArtifactUploadError("MKCOL {} {}".format(response.status, response.reason)) def __mkcol(self, url): + # MKCOL resources must have a trailing slash because they are + # directories. Otherwise Apache might send a HTTP 301. Nginx refuses to + # create the directory with a 409 which looks odd. + if not url.endswith("/"): + url += "/" connection = self._getConnection() connection.request("MKCOL", url, headers=self._getHeaders()) response = connection.getresponse()