mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-10-15 04:18:44 +00:00
fix(sandbox): sanitize @ in container names for WhatsApp LID chat IDs (#1031)
WhatsApp LID-format chat IDs contain @ (e.g. 551152861098:5@s.whatsapp.net) which is invalid in Docker container names, causing sandbox creation to fail for any WhatsApp-triggered agent session. Add @ to the sanitizeKey replacer alongside the existing : / . and space characters. Adds a test case with a realistic WhatsApp LID key. Fixes #1029 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e6ab6838cb
commit
23ddc0858c
2 files changed
+2
No files matched your search
@@ -454,6 +454,7 @@ func sanitizeKey(key string) string {
|
||||
"/", "-",
|
||||
" ", "-",
|
||||
".", "-",
|
||||
"@", "-",
|
||||
).Replace(key)
|
||||
|
||||
if len(safe) > 50 {
|
||||
|
||||
@@ -97,6 +97,7 @@ func TestSanitizeKey(t *testing.T) {
|
||||
{"simple", "simple"},
|
||||
{"has/slash", "has-slash"},
|
||||
{"has space", "has-space"},
|
||||
{"agent:chloe:whatsapp:551152861098:5@s.whatsapp.net", "agent-chloe-whatsapp-551152861098-5-s-whatsapp-net"},
|
||||
{strings.Repeat("x", 100), strings.Repeat("x", 50)},
|
||||
}
|
||||
for _, tc := range tests {
|
||||
|
||||
Reference in new issue
Block a user