Commit d2aa85d 1 parent 66af2a0 commit d2aa85d Copy full SHA for d2aa85d
File tree 3 files changed +8
-7
lines changed
3 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -184,9 +184,8 @@ func (a *Archiver) compress(file *pool.File) error {
184
184
return errors .New ("ERROR: could not create compressor" )
185
185
}
186
186
hasher := crc32 .NewIEEE ()
187
- w := io .MultiWriter (compressor , hasher )
188
187
189
- err = a .copy (w , file )
188
+ err = a .copy (io . MultiWriter ( compressor , hasher ) , file )
190
189
if err != nil {
191
190
return errors .Wrapf (err , "ERROR: could not read file %s" , file .Path )
192
191
}
Original file line number Diff line number Diff line change @@ -164,10 +164,6 @@ func TestCompress(t *testing.T) {
164
164
assert .True (t , file .Overflowed ())
165
165
assertGreaterThan (t , file .Written (), int64 (file .CompressedData .Len ()))
166
166
assert .Equal (t , file .Written (), int64 (file .Header .CompressedSize64 ))
167
-
168
- assert .NotZero (t , file .Overflow )
169
- overflowInfo := testutils .GetFileInfo (t , file .Overflow .Name ())
170
- assert .NotZero (t , overflowInfo .Size ())
171
167
})
172
168
173
169
t .Run ("for directories" , func (t * testing.T ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package pool
3
3
import (
4
4
"archive/zip"
5
5
"bytes"
6
+ "io"
6
7
"io/fs"
7
8
"os"
8
9
"path/filepath"
@@ -12,12 +13,17 @@ import (
12
13
13
14
const defaultBufferSize = 1000000
14
15
16
+ type Overflow interface {
17
+ io.ReadWriteSeeker
18
+ io.Closer
19
+ }
20
+
15
21
type File struct {
16
22
Path string
17
23
Info fs.FileInfo
18
24
CompressedData bytes.Buffer
19
25
Header * zip.FileHeader
20
- Overflow * os. File
26
+ Overflow Overflow
21
27
written int64
22
28
}
23
29
You can’t perform that action at this time.
0 commit comments