(filePath string, stat container.PathStat, isDir bool)
| 1596 | } |
| 1597 | |
| 1598 | func toContainerFileInfo(filePath string, stat container.PathStat, isDir bool) dto.ContainerFileInfo { |
| 1599 | name := stat.Name |
| 1600 | if len(name) == 0 { |
| 1601 | items := strings.Split(strings.TrimSuffix(filePath, "/"), "/") |
| 1602 | name = items[len(items)-1] |
| 1603 | } |
| 1604 | isLink := stat.Mode&os.ModeSymlink != 0 |
| 1605 | return dto.ContainerFileInfo{ |
| 1606 | Name: name, |
| 1607 | Path: filePath, |
| 1608 | IsDir: isDir, |
| 1609 | IsLink: isLink, |
| 1610 | LinkTo: stat.LinkTarget, |
| 1611 | Size: stat.Size, |
| 1612 | Mode: stat.Mode.String(), |
| 1613 | ModTime: stat.Mtime.Format(constant.DateTimeLayout), |
| 1614 | } |
| 1615 | } |
| 1616 | |
| 1617 | func isContainerDir(cli *client.Client, containerID, targetPath string) (bool, error) { |
| 1618 | checkPath := strings.TrimSuffix(targetPath, "/") + "/." |
no test coverage detected