MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _file_extension

Function _file_extension

src/command_system/copy_command.py:139–145  ·  view source on GitHub ↗

TS ``fileExtension`` (copy.tsx:62-72) — sanitized to prevent path traversal.

(lang: str | None)

Source from the content-addressed store, hash-verified

137
138
139def _file_extension(lang: str | None) -> str:
140 """TS ``fileExtension`` (copy.tsx:62-72) — sanitized to prevent path traversal."""
141 if lang:
142 sanitized = re.sub(r"[^a-zA-Z0-9]", "", lang)
143 if sanitized and sanitized != "plaintext":
144 return f".{sanitized}"
145 return ".txt"
146
147
148def _truncate_line(text: str, max_len: int) -> str:

Callers 2

test_file_extensionFunction · 0.90
_pickMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_file_extensionFunction · 0.72