mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
1 Distinguish between folders and common files, folders are listed first
2 Add some custom headers that need to be exposed
This commit is contained in:
parent
7458ff9523
commit
14ddd15508
|
@ -38,7 +38,17 @@ func (f *Filer) ListDirectoryEntries(ctx context.Context, p util.FullPath, start
|
|||
}
|
||||
}
|
||||
|
||||
return entries, err
|
||||
//Distinguish between folders and common files, folders are listed first
|
||||
var folderEntries, commonEntries []*Entry
|
||||
for i, _ := range entries {
|
||||
if entries[i].IsDirectory() {
|
||||
folderEntries = append(folderEntries, entries[i])
|
||||
} else {
|
||||
commonEntries = append(commonEntries, entries[i])
|
||||
}
|
||||
}
|
||||
folderEntries = append(folderEntries, commonEntries...)
|
||||
return folderEntries, err
|
||||
}
|
||||
|
||||
func (f *Filer) doListPatternMatchedEntries(ctx context.Context, p util.FullPath, startFileName string, inclusive bool, limit int, prefix, restNamePattern string) (matchedEntries []*Entry, missedCount int, lastFileName string, err error) {
|
||||
|
|
|
@ -100,6 +100,16 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
|
|||
w.Header().Set(k, string(v))
|
||||
}
|
||||
|
||||
//Add some custom headers that need to be exposed
|
||||
seaweedHeaders := []string{}
|
||||
for i, _ := range w.Header() {
|
||||
if strings.Contains(i, "Seaweed") {
|
||||
seaweedHeaders = append(seaweedHeaders, i)
|
||||
}
|
||||
}
|
||||
seaweedHeaders = append(seaweedHeaders, "Content-Disposition")
|
||||
w.Header().Set("Access-Control-Expose-Headers", strings.Join(seaweedHeaders, ","))
|
||||
|
||||
//set tag count
|
||||
if r.Method == "GET" {
|
||||
tagCount := 0
|
||||
|
|
Loading…
Reference in a new issue