Skip to content

Commit

Permalink
Updated redirects generator to deal better with going from foo/bar.md…
Browse files Browse the repository at this point in the history
… to foo/bar/index.md and vice-versa
  • Loading branch information
mostlyAtNight committed May 7, 2024
1 parent 6c76d67 commit 2b6dd4f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/check-redirects/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def slashify(url):
for old, new in renamed_pages_or_data_files:
old_full = full_url_from_file(old)
new_full = full_url_from_file(new)
if old_full == new_full:
# This occurs when we move from
# foo/bar.md to foo/bar/index.md or vice-versa
continue
redirect_found = False
for l, s, d in url_redirection_config:
if s == old_full and d == new_full:
Expand All @@ -134,6 +138,9 @@ def slashify(url):
redirections_to_recently_renamed_or_deleted_content = []
all_missing_content = deleted_pages
for item in renamed_pages_or_data_files:
if full_url_from_file(item[0]) == full_url_from_file(item[1]):
# Ignore the case where we are going from foo/bar.md to foo/bar/index.md or vice-versa
continue
all_missing_content.append(item[0])
for missing_content in all_missing_content:
missing_content = full_url_from_file(missing_content)
Expand Down

0 comments on commit 2b6dd4f

Please sign in to comment.