Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mar10 committed Nov 6, 2022
1 parent 73ea8f1 commit e5c757d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tests/test_wsgidav_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ def testDirBrowser(self):
# Access unmapped resource (expect '404 Not Found')
res = app.get("/not-existing-124/", status=404)

res = app.get("/subfolder/", status=200)
# res = app.get("/subfolder", status=301)
res = app.get("/subfolder") # seems to follow redirects?

def testGetPut(self):
"""Read and write file contents."""
app = self.app
Expand Down
2 changes: 1 addition & 1 deletion wsgidav/dir_browser/_dir_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def __call__(self, environ, start_response):

directory_slash = self.dir_config.get("directory_slash")
requrest_uri = environ.get("REQUEST_URI")
if directory_slash and not requrest_uri.endswith("/"):
if directory_slash and requrest_uri and not requrest_uri.endswith("/"):
_logger.info(f"Redirect {requrest_uri} to {requrest_uri}/")
return send_redirect_response(
environ, start_response, location=requrest_uri + "/"
Expand Down

0 comments on commit e5c757d

Please sign in to comment.