mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 16:27:25 +08:00
file size support set file length
use Attr.FileSize and TotalChunkSize to determine file size
This commit is contained in:
@@ -105,11 +105,11 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
|
||||
adjustHeaderContentDisposition(w, r, filename)
|
||||
|
||||
if r.Method == "HEAD" {
|
||||
w.Header().Set("Content-Length", strconv.FormatInt(int64(filer2.TotalSize(entry.Chunks)), 10))
|
||||
w.Header().Set("Content-Length", strconv.FormatInt(int64(entry.Size()), 10))
|
||||
return
|
||||
}
|
||||
|
||||
totalSize := int64(filer2.TotalSize(entry.Chunks))
|
||||
totalSize := int64(entry.Size())
|
||||
|
||||
if rangeReq := r.Header.Get("Range"); rangeReq == "" {
|
||||
ext := filepath.Ext(filename)
|
||||
|
@@ -338,7 +338,7 @@ func (fs *WebDavFileSystem) stat(ctx context.Context, fullFilePath string) (os.F
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fi.size = int64(filer2.TotalSize(entry.GetChunks()))
|
||||
fi.size = int64(filer2.FileSize(entry))
|
||||
fi.name = string(fullpath)
|
||||
fi.mode = os.FileMode(entry.Attributes.FileMode)
|
||||
fi.modifiledTime = time.Unix(entry.Attributes.Mtime, 0)
|
||||
@@ -507,7 +507,7 @@ func (f *WebDavFile) Readdir(count int) (ret []os.FileInfo, err error) {
|
||||
|
||||
err = filer_pb.ReadDirAllEntries(f.fs, util.FullPath(dir), "", func(entry *filer_pb.Entry, isLast bool) error {
|
||||
fi := FileInfo{
|
||||
size: int64(filer2.TotalSize(entry.GetChunks())),
|
||||
size: int64(filer2.FileSize(entry)),
|
||||
name: entry.Name,
|
||||
mode: os.FileMode(entry.Attributes.FileMode),
|
||||
modifiledTime: time.Unix(entry.Attributes.Mtime, 0),
|
||||
|
Reference in New Issue
Block a user