Close zstd encoder before reading file info, to ensure accurate file size reporting for index file
This commit is contained in:
parent
b90f6cfc64
commit
89637c12b2
|
@ -106,11 +106,17 @@ func (index *fileIndex) Export(path string) error {
|
|||
index.mutex.RLock()
|
||||
err = enc.Encode(&index.list)
|
||||
if err != nil {
|
||||
index.mutex.RUnlock()
|
||||
|
||||
return err
|
||||
}
|
||||
length := len(index.list)
|
||||
index.mutex.RUnlock()
|
||||
|
||||
// Close encoder prior to checking file size,
|
||||
// to ensure the correct value is returned.
|
||||
z.Close()
|
||||
|
||||
stats, err := file.Stat()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -154,6 +160,8 @@ func (index *fileIndex) Import(path string) error {
|
|||
index.mutex.Lock()
|
||||
err = dec.Decode(&index.list)
|
||||
if err != nil {
|
||||
index.mutex.Unlock()
|
||||
|
||||
return err
|
||||
}
|
||||
length := len(index.list)
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
const (
|
||||
AllowedCharacters string = `^[A-z0-9.\-_]+$`
|
||||
ReleaseVersion string = "3.7.0"
|
||||
ReleaseVersion string = "3.7.1"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
Loading…
Reference in New Issue