Skip to content

Commit

Permalink
Fix rel path tests for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
gudzpoz committed Jan 18, 2025
1 parent fbbd767 commit d1b366f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions nikola/nikola.py
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,8 @@ def filename_path(self, name, _lang):
link://filename/manual.txt => /docs/handbook.html
"""
results = [p for p in self.timeline if p.source_path == name]
name = os.path.normpath(name)
results = [p for p in self.timeline if os.path.normpath(p.source_path) == name]
if results:
if len(results) > 1:
utils.LOGGER.error("Ambiguous path request for filename: {0}".format(name))
Expand All @@ -1980,7 +1981,7 @@ def filename_path(self, name, _lang):
results = self.timeline
for p in results:
for lang in p.translated_to:
if p.translated_source_path(lang) == name:
if os.path.normpath(p.translated_source_path(lang)) == name:
return [_f for _f in p.permalink(lang).split('/') if _f]
utils.LOGGER.warning("Cannot resolve path request for filename: {0}".format(name))

Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_translated_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def test_translated_cross_links(build, output_dir, other_locale):
if text in expected:
link_count += 1
dest = os.path.join(os.path.dirname(f), href)
rel = os.path.relpath(dest, output_dir).strip('/')
assert rel == expected[text]
rel = os.path.relpath(dest, output_dir)
assert rel == os.path.normpath(expected[text])
assert link_count == len(expected)


Expand Down

0 comments on commit d1b366f

Please sign in to comment.