Simple S3-like server for development purposes, written in Go
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Complete ls business logic

+14 -4
+14 -4
server.go
··· 33 33 } 34 34 s.logger.Printf("Buckets: %s", files) 35 35 } else { 36 - // FIXME: "The returned path ends in a slash only if it represents a root directory, 37 - // such as "/" on Unix or `C:\` on Windows." 38 36 prefix := r.URL.Query().Get("prefix") 39 - path := filepath.Join(bucketName, prefix) 40 - s.logger.Printf("Path %s, original prefix %s", path, prefix) 37 + 38 + subpath, filter := filepath.Split(prefix) 39 + path := filepath.Join(bucketName, subpath) 40 + s.logger.Printf("Path %s + filter '%s' (original prefix %s)", path, filter, prefix) 41 + files, err := fs.ReadDir(root.FS(), path) 42 + if err != nil { 43 + http.Error(w, err.Error(), http.StatusInternalServerError) 44 + return 45 + } 46 + for _, file := range files { 47 + if strings.HasPrefix(file.Name(), filter) { 48 + s.logger.Printf("File %s", file) 49 + } 50 + } 41 51 } 42 52 43 53 // TODO: Probably requires actual XML