fix: Ensure that the encryption layer never tries to read from an empty stream
This commit is contained in:
@@ -223,7 +223,7 @@ func (f *File) enterWriteMode() error {
|
||||
|
||||
if f.writeBuf == nil {
|
||||
exists := false
|
||||
_, err := inventory.Stat(
|
||||
existingFile, err := inventory.Stat(
|
||||
f.metadata,
|
||||
|
||||
f.path,
|
||||
@@ -232,7 +232,9 @@ func (f *File) enterWriteMode() error {
|
||||
f.onHeader,
|
||||
)
|
||||
if err == nil {
|
||||
if existingFile.Size != 0 {
|
||||
exists = true
|
||||
}
|
||||
} else {
|
||||
if err != sql.ErrNoRows {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user