Skip to content

[Bug]: container cp fails with "invalid path given" when a path contains a colon #1969

Description

@OrtegaMatias

Steps to reproduce

  1. Create a file whose name contains a colon inside a container (common with ISO-8601 timestamps):
    container run -d --name cpbox alpine \
      sh -c 'echo hi > "/var/log/app-2026-07-20T10:30:00.log"; sleep 300'
    
  2. Copy it out:
    container cp "cpbox:/var/log/app-2026-07-20T10:30:00.log" ./out.log
    

Current behavior

Error: invalid path given: cpbox:/var/log/app-2026-07-20T10:30:00.log

The file exists in the container (a colon is a legal character in a Linux path); only the reference parsing fails. Copying a file whose name contains no colon works.

Expected behavior

The file is copied out — matching docker cp, which splits the container:path reference on the first colon only.

Root cause

Application.ContainerCopy.parsePathRef splits the reference on every colon (components(separatedBy: ":")) and rejects anything that produces more than two parts. Any colon in the path (after the id) makes the parse fail. It should split on the first colon only, since a container id cannot contain a path separator.

Environment

  • container 1.1.0
  • macOS 26.5 (Tahoe), Apple Silicon

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions