mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 07:33:21 +00:00
Ignore unexpected files in intermediate directories
Listing the data/ folder in a repository no longer fails if it contains files in the data/ folder. This also ignore .DS_Store files created by macOS.
This commit is contained in:
parent
11c5a548e8
commit
22a6412b81
3 changed files with 43 additions and 0 deletions
|
@ -379,6 +379,10 @@ func (h *Handler) listBlobsV1(w http.ResponseWriter, r *http.Request) {
|
|||
var names []string
|
||||
for _, i := range items {
|
||||
if isHashed(objectType) {
|
||||
if !i.IsDir() {
|
||||
// ignore files in intermediate directories
|
||||
continue
|
||||
}
|
||||
subpath := filepath.Join(path, i.Name())
|
||||
var subitems []os.FileInfo
|
||||
subitems, err = ioutil.ReadDir(subpath)
|
||||
|
@ -434,6 +438,10 @@ func (h *Handler) listBlobsV2(w http.ResponseWriter, r *http.Request) {
|
|||
var blobs []Blob
|
||||
for _, i := range items {
|
||||
if isHashed(objectType) {
|
||||
if !i.IsDir() {
|
||||
// ignore files in intermediate directories
|
||||
continue
|
||||
}
|
||||
subpath := filepath.Join(path, i.Name())
|
||||
var subitems []os.FileInfo
|
||||
subitems, err = ioutil.ReadDir(subpath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue