mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-27 17:08:38 +00:00
Skills/Python: harden script edge cases and add regression tests (#24277)
* Skill creator: skip self-including .skill output * Skill creator tests: cover output-dir-inside-skill case * Skill validator: parse frontmatter robustly across newlines * Skill validator tests: add CRLF and malformed frontmatter coverage * Model usage: require positive --days value * Model usage tests: cover --days validation and filtering * Nano banana: close input image handles after loading * Skill validator: keep type hints compatible with older python * Changelog: credit @vincentkoc for Python skills hardening
This commit is contained in:
@@ -93,6 +93,10 @@ def package_skill(skill_path, output_dir=None):
|
||||
if not _is_within(resolved_file, skill_path):
|
||||
print(f"[ERROR] File escapes skill root: {file_path}")
|
||||
return None
|
||||
# If output lives under skill_path, avoid writing archive into itself.
|
||||
if resolved_file == skill_filename.resolve():
|
||||
print(f"[WARN] Skipping output archive: {file_path}")
|
||||
continue
|
||||
|
||||
# Calculate the relative path within the zip.
|
||||
arcname = Path(skill_name) / file_path.relative_to(skill_path)
|
||||
|
||||
Reference in New Issue
Block a user