skills-hub: hash binary skill bundle files correctly
This commit is contained in:
@@ -2801,7 +2801,11 @@ def bundle_content_hash(bundle: SkillBundle) -> str:
|
||||
"""Compute a deterministic hash for an in-memory skill bundle."""
|
||||
h = hashlib.sha256()
|
||||
for rel_path in sorted(bundle.files):
|
||||
h.update(bundle.files[rel_path].encode("utf-8"))
|
||||
content = bundle.files[rel_path]
|
||||
if isinstance(content, bytes):
|
||||
h.update(content)
|
||||
else:
|
||||
h.update(content.encode("utf-8"))
|
||||
return f"sha256:{h.hexdigest()[:16]}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user