fix: strip file extension when looking up location in _handle_rename

The bug: _handle_rename was looking up file location using paths WITH extensions (e.g., 'en/.../file.mdx'), but docs.json entries don't include extensions.

This caused location lookup to fail, skipping the docs.json update step entirely.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Gu
2025-11-13 11:07:14 +08:00
parent f5fac82c8e
commit 8bf899c6e1

View File

@@ -1295,10 +1295,18 @@ class DocsSynchronizer:
# Extract file location from English section (use new path since English already renamed)
file_locations = self.extract_file_locations(en_section)
location = file_locations.get(new_en_path)
# Strip file extension from path since docs.json entries don't include extensions
new_en_path_no_ext = new_en_path
if new_en_path.endswith('.mdx'):
new_en_path_no_ext = new_en_path[:-4]
elif new_en_path.endswith('.md'):
new_en_path_no_ext = new_en_path[:-3]
location = file_locations.get(new_en_path_no_ext)
if not location:
log.append(f"WARNING: Could not find location for {new_en_path} in English section")
log.append(f"WARNING: Could not find location for {new_en_path_no_ext} in English section")
# Continue without updating docs.json entries
location = None