1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-01-17 12:48:28 +01:00

Merge branch 'hotfix/3.1.5'

This commit is contained in:
Ne-Lexa 2018-04-25 12:44:11 +03:00
commit 251ce11bdc
3 changed files with 54 additions and 50 deletions

View File

@ -1,45 +1,47 @@
{
"name": "nelexa/zip",
"description": "PhpZip is a php-library for extended work with ZIP-archives. Open, create, update, delete, extract and get info tool. Supports appending to existing ZIP files, WinZip AES encryption, Traditional PKWARE Encryption, ZipAlign tool, BZIP2 compression, external file attributes and ZIP64 extensions. Alternative ZipArchive. It does not require php-zip extension.",
"type": "library",
"keywords": [
"zip",
"unzip",
"archive",
"extract",
"winzip",
"zipalign",
"ziparchive"
],
"require-dev": {
"phpunit/phpunit": "4.8"
},
"license": "MIT",
"authors": [
{
"name": "Ne-Lexa",
"email": "alexey@nelexa.ru",
"role": "Developer"
}
],
"minimum-stability": "stable",
"require": {
"php": "^5.5 || ^7.0",
"psr/http-message": "^1.0"
},
"autoload": {
"psr-4": {
"PhpZip\\": "src/PhpZip"
}
},
"autoload-dev": {
"psr-4": {
"PhpZip\\": "tests/PhpZip"
}
},
"suggest": {
"ext-openssl": "Needed to support encrypt zip entries or use ext-mcrypt",
"ext-mcrypt": "Needed to support encrypt zip entries or use ext-openssl",
"ext-bz2": "Needed to support BZIP2 compression"
}
"name": "nelexa/zip",
"type": "library",
"description": "PhpZip is a php-library for extended work with ZIP-archives. Open, create, update, delete, extract and get info tool. Supports appending to existing ZIP files, WinZip AES encryption, Traditional PKWARE Encryption, ZipAlign tool, BZIP2 compression, external file attributes and ZIP64 extensions. Alternative ZipArchive. It does not require php-zip extension.",
"keywords": [
"zip",
"unzip",
"archive",
"extract",
"winzip",
"zipalign",
"ziparchive"
],
"homepage": "https://github.com/Ne-Lexa/php-zip",
"license": "MIT",
"authors": [
{
"name": "Ne-Lexa",
"email": "alexey@nelexa.ru",
"role": "Developer"
}
],
"require": {
"php": "^5.5 || ^7.0",
"psr/http-message": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8|~5.7",
"zendframework/zend-diactoros": "^1.4"
},
"autoload": {
"psr-4": {
"PhpZip\\": "src/PhpZip"
}
},
"autoload-dev": {
"psr-4": {
"PhpZip\\": "tests/PhpZip"
}
},
"suggest": {
"ext-openssl": "Needed to support encrypt zip entries or use ext-mcrypt",
"ext-mcrypt": "Needed to support encrypt zip entries or use ext-openssl",
"ext-bz2": "Needed to support BZIP2 compression"
},
"minimum-stability": "stable"
}

View File

@ -1299,11 +1299,11 @@ class ZipFile implements ZipFileInterface
}
$stream = new ResponseStream($handle);
$response->withHeader('Content-Type', $mimeType);
$response->withHeader('Content-Disposition', $contentDispositionValue);
$response->withHeader('Content-Length', $stream->getSize());
$response->withBody($stream);
return $response;
return $response
->withHeader('Content-Type', $mimeType)
->withHeader('Content-Disposition', $contentDispositionValue)
->withHeader('Content-Length', $stream->getSize())
->withBody($stream);
}
/**

View File

@ -7,6 +7,7 @@ use PhpZip\Model\ZipInfo;
use PhpZip\Util\CryptoUtil;
use PhpZip\Util\FilesUtil;
use Psr\Http\Message\ResponseInterface;
use Zend\Diactoros\Response;
/**
* ZipFile test
@ -1786,9 +1787,10 @@ class ZipFileTest extends ZipTestCase
$zipFile[$i] = $i;
}
$filename = 'file.jar';
$response = $this->getMock(ResponseInterface::class);
$response = $zipFile->outputAsResponse($response, $filename);
$response = $zipFile->outputAsResponse(new Response(), $filename);
$this->assertInstanceOf(ResponseInterface::class, $response);
$this->assertEquals('application/java-archive', $response->getHeaderLine('content-type'));
$this->assertEquals('attachment; filename="file.jar"', $response->getHeaderLine('content-disposition'));
}
public function testCompressionLevel()