We use `:` as a delimiter between CONTAINER and PATH, but `:` could also be in a valid LOCALPATH, like `file:name.txt`. We can resolve this ambiguity by requiring a LOCALPATH with a `:` to be made explicit with a relative or absolute path: `/path/to/file:name.txt` or `./file:name.txt` This is app
(arg string)
| 500 | // client, a `:` could be part of an absolute Windows path, in which case it |
| 501 | // is immediately proceeded by a backslash. |
| 502 | func splitCpArg(arg string) (ctr, path string) { |
| 503 | if isAbs(arg) { |
| 504 | // Explicit local absolute path, e.g., `C:\foo` or `/foo`. |
| 505 | return "", arg |
| 506 | } |
| 507 | |
| 508 | ctr, path, ok := strings.Cut(arg, ":") |
| 509 | if !ok || strings.HasPrefix(ctr, ".") { |
| 510 | // Either there's no `:` in the arg |
| 511 | // OR it's an explicit local relative path like `./file:name.txt`. |
| 512 | return "", arg |
| 513 | } |
| 514 | |
| 515 | return ctr, path |
| 516 | } |
| 517 | |
| 518 | // IsAbs is a platform-agnostic wrapper for filepath.IsAbs. |
| 519 | // |
searching dependent graphs…