@@ -26,26 +26,22 @@ func handlePypiFileNames(key string) string {
26
26
func handlePypiListDir (fetcher FileFetcher , path string ) ([]ListDirEntry , error ) {
27
27
prefix := strings .TrimPrefix (path , "/" ) // remove initial /
28
28
prefix = strings .TrimSuffix (prefix , "/" ) // and last one
29
+ prefix = strings .Replace (prefix , "-" , "_" , - 1 )
30
+
29
31
30
32
if len (prefix ) < 1 {
31
33
return nil , fmt .Errorf ("expected a directory to list" )
32
34
}
33
35
34
- // case-insensitive search, search for X* + x*
35
- lowerFiles , err := fetcher .ListDir (strings .ToLower (prefix ))
36
- if err != nil {
37
- return lowerFiles , err
38
- }
39
- upperFiles , err := fetcher .ListDir (strings .ToUpper (prefix ))
36
+ files , err := fetcher .ListDir (prefix )
40
37
if err != nil {
41
- return upperFiles , err
38
+ return files , err
42
39
}
43
40
44
- // now merge both and filter by normalized prefix comparison.
45
- allFiles := append (lowerFiles , upperFiles ... )
41
+ // now filter by normalized prefix comparison.
46
42
normalizedPrefix := normalizeFileName (prefix )
47
43
var results []ListDirEntry
48
- for _ , entry := range allFiles {
44
+ for _ , entry := range files {
49
45
fileName := normalizeFileName (entry .Name )
50
46
if strings .HasPrefix (fileName , normalizedPrefix ) {
51
47
results = append (results , entry )
0 commit comments