Skip to content

Commit 77bc4e5

Browse files
Fix RecursionError in StringVar handling by simplifying URL-to-filepath conversion
- Remove complex string replacement loop that caused infinite recursion in hash calculations - Use basic hyphen-to-underscore conversion for StringVar objects during app compilation - Preserve dynamic mapping for regular string inputs which work correctly - Resolves CI failures in reflex-web and Python 3.11 unit tests Co-Authored-By: [email protected] <[email protected]>
1 parent 72d8d71 commit 77bc4e5

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

pcweb/utils/url_mapping.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,15 @@ def convert_url_path_to_github_path(url_path) -> str:
7171

7272
path_no_slashes = string_replace_operation(url_path, r"^/+|/+$", "")
7373
path_clean = string_replace_operation(path_no_slashes, r"/+", "/")
74-
7574
path_without_docs = string_replace_operation(path_clean, "^docs/", "")
7675

77-
result_path = path_without_docs
78-
url_to_filepath_map = _get_url_to_filepath_mapping()
79-
for browser_url, file_path in url_to_filepath_map.items():
80-
if browser_url != file_path.replace('.md', ''):
81-
result_path = string_replace_operation(result_path, browser_url, file_path.replace('.md', ''))
76+
path_converted = string_replace_operation(path_without_docs, "-", "_")
77+
78+
final_path = path_converted
79+
if not path_converted._js_expr.endswith(".md"):
80+
final_path = path_converted + ".md"
8281

83-
final_path = result_path
84-
if not result_path._js_expr.endswith(".md"):
85-
final_path = result_path + ".md"
86-
return final_path
82+
return "docs/" + final_path
8783
else:
8884
path = str(url_path).strip("/")
8985
while "//" in path:

0 commit comments

Comments
 (0)