Check disk space before trying a write from the downloader; don't make empty directories if we can't even write the file

This commit is contained in:
Dane Everitt
2020-12-20 11:17:53 -08:00
parent 9c53436470
commit c718da20e3
4 changed files with 33 additions and 22 deletions

View File

@@ -203,7 +203,7 @@ func (fs *Filesystem) DirectorySize(dir string) (int64, error) {
// Helper function to determine if a server has space available for a file of a given size.
// If space is available, no error will be returned, otherwise an ErrNotEnoughSpace error
// will be raised.
func (fs *Filesystem) hasSpaceFor(size int64) error {
func (fs *Filesystem) HasSpaceFor(size int64) error {
if fs.MaxDisk() == 0 {
return nil
}