Skip to content

Fix: sanitize container name for paths with spaces#144

Merged
raine merged 2 commits intoraine:mainfrom
txmxthy:fix/sanitize-container-name
Apr 25, 2026
Merged

Fix: sanitize container name for paths with spaces#144
raine merged 2 commits intoraine:mainfrom
txmxthy:fix/sanitize-container-name

Conversation

@txmxthy
Copy link
Copy Markdown
Contributor

@txmxthy txmxthy commented Apr 23, 2026

Summary

  • workmux sandbox run '/path/AI Enablement' fails because Docker rejects the container name wm-AI Enablement-12345 (spaces not allowed in container names)
  • Fix: apply slug::slugify() (already a dependency) to the directory basename before building the container name
  • AI Enablementai-enablementwm-ai-enablement-12345

Change

One-line change in src/command/sandbox_run.rs — wraps the existing file_name() extraction in slug::slugify().

Test plan

  • cargo build --release succeeds
  • workmux sandbox run '/path/with spaces/' -- echo test no longer fails with "Invalid container name"
  • Paths without spaces are unaffected (slugify is a no-op on clean names)

txmxthy and others added 2 commits April 23, 2026 12:57
`workmux sandbox run '/path/AI Enablement'` failed because Docker
rejects container names with spaces. The handle was derived from the
raw directory basename without sanitization.

Fix: apply `slug::slugify()` (already in deps) to the handle before
building the container name. `AI Enablement` → `ai-enablement` →
`wm-ai-enablement-12345`.
The original PR fix slugified the entire `handle` variable, which is
used both for the Docker container name and as the state store key.
This caused cleanup to fail for paths with spaces: `remove` derives the
handle from the raw directory name (no slugify), so `list_containers`
looked up the wrong key and found nothing, leaving containers running.

Separate the two: keep `handle` as the raw directory basename so the
state store key is consistent everywhere, and apply slugify only when
constructing `container_name` to satisfy Docker's naming constraints.
@raine raine merged commit c462294 into raine:main Apr 25, 2026
@raine
Copy link
Copy Markdown
Owner

raine commented Apr 25, 2026

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants