Skip to content

Commit d1e2310

Browse files
Treat non-alnum fetching separators as idempotent prefixes
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 5cee658 commit d1e2310

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

hyperbrowser/client/polling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def build_fetch_operation_name(operation_name: object) -> str:
136136
if next_character_index == len(normalized_lower_operation_name):
137137
return normalized_operation_name
138138
next_character = normalized_lower_operation_name[next_character_index]
139-
if next_character.isspace() or next_character == "?":
139+
if not next_character.isalnum():
140140
return normalized_operation_name
141141
return build_operation_name(
142142
_FETCH_OPERATION_NAME_PREFIX,

tests/test_polling.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,13 @@ def test_build_fetch_operation_name_is_idempotent_for_sanitized_fetch_separator(
7070
assert normalized_operation_name.count("Fetching") == 1
7171

7272

73+
def test_build_fetch_operation_name_is_idempotent_for_punctuation_separator():
74+
operation_name = "Fetching...crawl job 123"
75+
normalized_operation_name = build_fetch_operation_name(operation_name)
76+
77+
assert normalized_operation_name == operation_name
78+
79+
7380
def test_build_fetch_operation_name_prefixes_non_separator_fetching_variants():
7481
operation_name = "FetchingTask"
7582
normalized_operation_name = build_fetch_operation_name(operation_name)

0 commit comments

Comments
 (0)