Skip to content

Commit e928f61

Browse files
authored
Merge pull request #138 from deonthomasgy/main
fix uploading gz snapshot
2 parents c2156b5 + a0a3de2 commit e928f61

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Snapshot.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,14 @@ protected function shouldIgnoreLine(string $line): bool
9191
protected function loadStream(string $connectionName = null)
9292
{
9393
LazyCollection::make(function () {
94-
$stream = $this->disk->readStream($this->fileName);
94+
$stream = $this->compressionExtension === 'gz'
95+
? gzopen($this->disk->path($this->fileName), 'r')
96+
: $this->disk->readStream($this->fileName);
9597

9698
$statement = '';
9799
while (! feof($stream)) {
98100
$chunk = $this->compressionExtension === 'gz'
99-
? gzdecode(gzread($stream, self::STREAM_BUFFER_SIZE))
101+
? gzread($stream, self::STREAM_BUFFER_SIZE)
100102
: fread($stream, self::STREAM_BUFFER_SIZE);
101103

102104
$lines = explode("\n", $chunk);

0 commit comments

Comments
 (0)