Truncate and unreserve on file replacement

master
Caj Larsson 3 years ago
parent d1e53c2337
commit adbb5dbc43

@ -77,6 +77,8 @@ func (s SwampFileService) SaveFile(ref swampfile.FileReference, src io.Reader, s
return err
}
ns.Usage = ns.Usage.Add(-f.Size())
written, err := io.CopyN(f, src, size)
if written < size {

@ -98,6 +98,7 @@ func (f Repository) Create(filename string, namespace_ns string) (swampfile.Swam
if err != nil {
panic(err)
}
file.Truncate(0)
bfd := FileSystemSwampFileData{filename, stat_info.Size(), stat_info.ModTime(), file}

Loading…
Cancel
Save