Merge branch 'master' into mq-subscribe
This commit is contained in:
@@ -3,6 +3,7 @@ package weed_server
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
@@ -117,9 +118,12 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
return
|
||||
}
|
||||
if query.Get("metadata") == "true" && fs.option.ExposeDirectoryData != false {
|
||||
writeJsonQuiet(w, r, http.StatusOK, entry)
|
||||
return
|
||||
if query.Get("metadata") == "true" {
|
||||
// Don't return directory meta if config value is set to true
|
||||
if fs.option.ExposeDirectoryData == false {
|
||||
writeJsonError(w, r, http.StatusForbidden, errors.New("directory listing is disabled"))
|
||||
return
|
||||
}
|
||||
}
|
||||
if entry.Attr.Mime == "" || (entry.Attr.Mime == s3_constants.FolderMimeType && r.Header.Get(s3_constants.AmzIdentityId) == "") {
|
||||
// return index of directory for non s3 gateway
|
||||
@@ -135,7 +139,7 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
|
||||
return
|
||||
}
|
||||
|
||||
if query.Get("metadata") == "true" && fs.option.ExposeDirectoryData != false {
|
||||
if query.Get("metadata") == "true" {
|
||||
if query.Get("resolveManifest") == "true" {
|
||||
if entry.Chunks, _, err = filer.ResolveChunkManifest(
|
||||
fs.filer.MasterClient.GetLookupFileIdFunction(),
|
||||
|
||||
@@ -2,6 +2,7 @@ package weed_server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -12,14 +13,14 @@ import (
|
||||
"github.com/seaweedfs/seaweedfs/weed/util"
|
||||
)
|
||||
|
||||
// listDirectoryHandler lists directories and folers under a directory
|
||||
// listDirectoryHandler lists directories and folders under a directory
|
||||
// files are sorted by name and paginated via "lastFileName" and "limit".
|
||||
// sub directories are listed on the first page, when "lastFileName"
|
||||
// is empty.
|
||||
func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
if fs.option.ExposeDirectoryData == false {
|
||||
http.NotFound(w, r)
|
||||
writeJsonError(w, r, http.StatusForbidden, errors.New("ui is disabled"))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ func uploadViaRclone(rfs fs.Fs, filename string, key string, fn func(progressed
|
||||
|
||||
info := object.NewStaticObjectInfo(key, stat.ModTime(), stat.Size(), true, nil, rfs)
|
||||
|
||||
tr := accounting.NewStats(ctx).NewTransfer(info)
|
||||
tr := accounting.NewStats(ctx).NewTransfer(info, rfs)
|
||||
defer tr.Done(ctx, err)
|
||||
acc := tr.Account(ctx, file)
|
||||
pr := ProgressReader{acc: acc, tr: tr, fn: fn}
|
||||
|
||||
Reference in New Issue
Block a user