(source fileStatProvider, parentPath string, pattern string)
| 912 | } |
| 913 | |
| 914 | func matchRemotePattern(source fileStatProvider, parentPath string, pattern string) ([]string, error) { |
| 915 | parentID := "" |
| 916 | if parentPath != "/" { |
| 917 | var err error |
| 918 | parentID, err = source.GetPathFolderId(parentPath) |
| 919 | if err != nil { |
| 920 | return nil, err |
| 921 | } |
| 922 | } |
| 923 | |
| 924 | files, err := source.GetFolderFileStatList(parentID) |
| 925 | if err != nil { |
| 926 | return nil, err |
| 927 | } |
| 928 | |
| 929 | matches := make([]string, 0) |
| 930 | for _, file := range files { |
| 931 | matched, err := path.Match(pattern, file.Name) |
| 932 | if err != nil { |
| 933 | return nil, fmt.Errorf("shell: invalid wildcard pattern %s: %w", pattern, err) |
| 934 | } |
| 935 | if matched { |
| 936 | matches = append(matches, path.Join(parentPath, file.Name)) |
| 937 | } |
| 938 | } |
| 939 | return matches, nil |
| 940 | } |
| 941 | |
| 942 | func expandLocalPatternToken(token string) ([]string, error) { |
| 943 | if !hasWildcard(token) { |
no test coverage detected