Merge pull request #6291 from dhiltgen/no_sparse_fail

Don't hard fail on sparse setup error
This commit is contained in:
Daniel Hiltgen 2024-08-09 12:30:25 -07:00 committed by GitHub
commit b7f7d8cd15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 7 deletions

View file

@ -216,9 +216,7 @@ func (b *blobDownload) run(ctx context.Context, requestURL *url.URL, opts *regis
return err return err
} }
defer file.Close() defer file.Close()
if err := setSparse(file); err != nil { setSparse(file)
return err
}
_ = file.Truncate(b.Total) _ = file.Truncate(b.Total)

View file

@ -4,6 +4,5 @@ package server
import "os" import "os"
func setSparse(file *os.File) error { func setSparse(*os.File) {
return nil
} }

View file

@ -6,8 +6,9 @@ import (
"golang.org/x/sys/windows" "golang.org/x/sys/windows"
) )
func setSparse(file *os.File) error { func setSparse(file *os.File) {
return windows.DeviceIoControl( // exFat (and other FS types) don't support sparse files, so ignore errors
windows.DeviceIoControl( //nolint:errcheck
windows.Handle(file.Fd()), windows.FSCTL_SET_SPARSE, windows.Handle(file.Fd()), windows.FSCTL_SET_SPARSE,
nil, 0, nil, 0,
nil, 0, nil, 0,