mirror of
https://github.com/apple/container.git
synced 2026-07-12 04:27:05 +00:00
09489cba45
Fixes #1738 `container cp` fails when the host source path is relative (e.g. `container cp file foo:/root/`), because `NSString.standardizingPath` only canonicalizes paths but does not make them absolute. The unchanged relative path is then interpreted as `/file` (root-absolute) by `URL(fileURLWithPath:)` on the runtime side. Fixed by resolving relative paths against the current working directory before use, matching the pattern already used by `container export`, `container image save`, and `container image load`. The same fix was also applied to the copy-out destination path (line 68), which had the same issue. ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Breaking change - [ ] Documentation update ## Motivation and Context `container cp file foo:/root/` fails with `"copyIn: source not found '/file'"` because the relative path `file` is never expanded to an absolute path. Using `$PWD/file` works, but relative paths should work too — every other command in the codebase handles this correctly. ## Testing - [x] Tested locally — builds and all existing tests pass - [ ] Added/updated tests - [ ] Added/updated docs --------- Co-authored-by: jwhur <57657645+JaewonHur@users.noreply.github.com>