fix: Ensure that the encryption layer never tries to read from an empty stream

This commit is contained in:
Felicitas Pojtinger
2022-05-16 00:15:18 +02:00
parent f5f3b8efe2
commit a890270019

View File

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