Skip to content

Commit 1dffd36

Browse files
authored
fix: hash skill binaries (#255)
1 parent 3c4e7b7 commit 1dffd36

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/agent_scan/skill_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import hashlib
12
import logging
23
import os
34

@@ -122,7 +123,9 @@ def traverse_skill_tree(skill_path: str, relative_path: str | None) -> tuple[lis
122123
content = f.read()
123124
except UnicodeDecodeError:
124125
logger.exception(f"Error reading file: {file}. The file is not a bianry")
125-
content = "Binary file. No content available."
126+
with open(os.path.expanduser(full_path), "rb") as f:
127+
content_hash = hashlib.sha256(f.read()).hexdigest()
128+
content = f"Binary file. Hash: {content_hash}"
126129
resources.append(
127130
Resource(
128131
name=file,

0 commit comments

Comments
 (0)