Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bottle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2883,7 +2883,7 @@ def static_file(filename, root,

if not filename.startswith(root):
return HTTPError(403, "Access denied.")
if not os.path.exists(filename) or not os.path.isfile(filename):
if not os.path.isfile(filename):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, this is redundant.

In [71]: os.path.isfile("no-such-file")
Out[71]: False

@SergBobrovsky I believe that it will be easier for @defnull to review all your PRs if your commit messages are a bit more verbose.
Adding stuff like this in the commit message surely helps.

return HTTPError(404, "File does not exist.")
if not os.access(filename, os.R_OK):
return HTTPError(403, "You do not have permission to access this file.")
Expand Down