diff --git a/tests/test_link_checker.py b/tests/test_link_checker.py index 50c787c..5a9b4d9 100644 --- a/tests/test_link_checker.py +++ b/tests/test_link_checker.py @@ -510,6 +510,7 @@ def test__github_link_invalid(self, root, payload): [ {"string": "This link is [ok](https://github.com/ppy/osu-wiki/blob/master/wiki/Another_article/en.md).", "resolved_location": "wiki/Another_article/en.md"}, {"string": "This link is [also ok](https://github.com/ppy/osu-wiki/tree/master/wiki/Another_article).", "resolved_location": "wiki/Another_article"}, + {"string": "This link is [very ok](https://github.com/ppy/osu-wiki/tree/master/news).", "resolved_location": "news"}, {"string": "This link is [another ok link](https://github.com/ppy/osu-wiki/tree/master/README.md).", "resolved_location": "README.md"}, ] ) @@ -517,6 +518,7 @@ def test__github_link_valid(self, root, payload): utils.create_files( root, ('wiki/Another_article/en.md', '# Another article'), + ('news/2023/newspost.md', '# news post'), ('README.md', '# Please read me') ) diff --git a/wikitools/file_utils.py b/wikitools/file_utils.py index 23088f8..898cd7c 100644 --- a/wikitools/file_utils.py +++ b/wikitools/file_utils.py @@ -51,7 +51,7 @@ def exists_case_insensitive(path: pathlib.Path) -> bool: # case-insensitive directory/file existence checking isn't trivial in case-sensitive file systems because os-provided existence checks can't be relied upon # this cache would only become invalid when the current working directory changes, which only happens in tests and not during normal execution if not hasattr(exists_case_insensitive, 'all_article_paths_lowercased'): - article_set = set(normalised(article_path.lower()) for article_path in itertools.chain(list_all_dirs(), list_all_files(["."]))) + article_set = set(normalised(article_path.lower()) for article_path in itertools.chain(list_all_dirs(["."]), list_all_files(["."]))) setattr(exists_case_insensitive, 'all_article_paths_lowercased', article_set) all_article_paths_lowercased = getattr(exists_case_insensitive, 'all_article_paths_lowercased')