1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-29 16:55:32 +00:00

Extract httputils.redirect

This commit is contained in:
Unrud 2022-01-18 18:20:15 +01:00
parent 113eeec847
commit 9e9f2bb780
4 changed files with 10 additions and 12 deletions

View file

@ -75,10 +75,7 @@ class Web(web.BaseWeb):
path, e, exc_info=True)
return httputils.NOT_FOUND
if os.path.isdir(filesystem_path) and not path.endswith("/"):
location = posixpath.basename(path) + "/"
return (client.FOUND,
{"Location": location, "Content-Type": "text/plain"},
"Redirected to %s" % location)
return httputils.redirect(posixpath.basename(path) + "/")
if os.path.isdir(filesystem_path):
filesystem_path = os.path.join(filesystem_path, "index.html")
if not os.path.isfile(filesystem_path):