Skip to content

Commit 6e5472e

Browse files
authored
Merge pull request #100 from fitztrev/patch-1
Make sure zip file is valid before extracting
2 parents d255663 + 2f2c5cc commit 6e5472e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/NewCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ protected function extract($zipFile, $directory)
152152
{
153153
$archive = new ZipArchive;
154154

155-
$archive->open($zipFile);
155+
$response = $archive->open($zipFile, ZipArchive::CHECKCONS);
156+
157+
if ($response === ZipArchive::ER_NOZIP) {
158+
throw new RuntimeException('The zip file could not download. Verify that you are able to access: http://cabinet.laravel.com/latest.zip');
159+
}
156160

157161
$archive->extractTo($directory);
158162

0 commit comments

Comments
 (0)