diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-11-19 16:36:06 -0800 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2025-11-19 16:36:06 -0800 |
| commit | 1b2df8a630bfc83304ef90610bdf7ebe91d4e555 (patch) | |
| tree | 9a9df319d5cc16ab9cdebf481515c11f648a4ba1 /hotline/file_wrapper.go | |
| parent | b395859da4937fa4c3064f4e022e46690df8f2d4 (diff) | |
Fix error when downloading incomplete files
Diffstat (limited to 'hotline/file_wrapper.go')
| -rw-r--r-- | hotline/file_wrapper.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/hotline/file_wrapper.go b/hotline/file_wrapper.go index 41b3338..b80bc4b 100644 --- a/hotline/file_wrapper.go +++ b/hotline/file_wrapper.go @@ -30,7 +30,7 @@ type File struct { Ffo *flattenedFileObject } -func NewFileWrapper(fs FileStore, path string, dataOffset int64) (*File, error) { +func NewFile(fs FileStore, path string, dataOffset int64) (*File, error) { dir := filepath.Dir(path) fName := filepath.Base(path) f := File{ @@ -130,7 +130,11 @@ func (f *File) incFileWriter() (io.WriteCloser, error) { } func (f *File) dataForkReader() (io.Reader, error) { - return f.fs.Open(f.dataPath) + if _, err := f.fs.Stat(f.dataPath); err == nil { + return f.fs.Open(f.dataPath) + } + + return f.fs.Open(f.incompletePath) } func (f *File) rsrcForkFile() (*os.File, error) { |