Skip to content

Commit

Permalink
Merge pull request #58 from w3c/jgraham/directory_slash
Browse files Browse the repository at this point in the history
Ensure directory access only happens with request paths that end in a /
  • Loading branch information
jgraham committed Jun 11, 2015
2 parents 67d7f70 + 8016c0f commit 4a7a937
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wptserve/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def __init__(self, base_path=None, url_base="/"):
self.url_base = url_base

def __call__(self, request, response):
if not request.url_parts.path.endswith("/"):
raise HTTPException(404)

path = filesystem_path(self.base_path, request, self.url_base)

assert os.path.isdir(path)
Expand Down

0 comments on commit 4a7a937

Please sign in to comment.