Skip to content

Commit 03f5cc7

Browse files
committed
Coderabbit fixes.
1 parent 9ec42fb commit 03f5cc7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Server/src/services/tools/find_in_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ async def find_in_file(
9797

9898
data = read_resp.get("data", {})
9999
contents = data.get("contents")
100-
if not contents and data.get("contentsEncoded"):
100+
if not contents and data.get("contentsEncoded") and data.get("encodedContents"):
101101
try:
102102
contents = base64.b64decode(data.get("encodedContents", "").encode(
103103
"utf-8")).decode("utf-8", "replace")
104104
except (ValueError, TypeError, base64.binascii.Error):
105105
contents = contents or ""
106106

107107
if contents is None:
108-
return {"success": False, "message": "Could not read file content."}
108+
return {"success": False, "message": "Could not read file content."}
109109

110110
# 2. Perform regex search
111111
flags = re.MULTILINE

Server/src/services/tools/manage_script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _needs_normalization(arr: list[dict[str, Any]]) -> bool:
121121
return read_resp if isinstance(read_resp, dict) else {"success": False, "message": str(read_resp)}
122122
data = read_resp.get("data", {})
123123
contents = data.get("contents")
124-
if not contents and data.get("contentsEncoded"):
124+
if not contents and data.get("contentsEncoded") and data.get("encodedContents"):
125125
try:
126126
contents = base64.b64decode(data.get("encodedContents", "").encode(
127127
"utf-8")).decode("utf-8", "replace")

0 commit comments

Comments
 (0)