Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
adamchainz committed Nov 8, 2022
1 parent a3949ef commit 3315f9d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/whitenoise/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ def serve(
else:
return []

def add_files(self, root: str, prefix: str | None = None) -> None:
def add_files(
self, root: str | os.PathLike[str], prefix: str | None = None
) -> None:
root = decode_if_byte_string(root, force_text=True)
root = os.path.abspath(root)
root = root.rstrip(os.path.sep) + os.path.sep
Expand Down Expand Up @@ -155,7 +157,7 @@ def add_file_to_dictionary(
def find_file(self, url: str) -> Redirect | StaticFile | None:
# Optimization: bail early if the URL can never match a file
if self.index_file is None and url.endswith("/"):
return
return None
if not self.url_is_canonical(url):
return None
for path in self.candidate_paths_for_url(url):
Expand Down

0 comments on commit 3315f9d

Please sign in to comment.