diff --git a/src/whitenoise/base.py b/src/whitenoise/base.py index ab800304..44244539 100644 --- a/src/whitenoise/base.py +++ b/src/whitenoise/base.py @@ -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 @@ -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):