file size support set file length

use Attr.FileSize and TotalChunkSize to determine file size
This commit is contained in:
Chris Lu
2020-08-15 09:32:47 -07:00
parent c03bb180eb
commit c647deace1
16 changed files with 73 additions and 39 deletions

View File

@@ -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)