mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user