Skip to content

Commit

Permalink
archive: fix MKCOL WebDAV method
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jkloetzke committed Jul 1, 2024
1 parent c5e7e0e commit b808774
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pym/bob/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit b808774

Please sign in to comment.