From 2e886e3d2412621d0bba4923f5f4cd8f2a20293c Mon Sep 17 00:00:00 2001 From: Michael Henderson Date: Tue, 28 Feb 2023 14:46:02 +1000 Subject: [PATCH] fix(params): Allow StoreFile param to be overridden --- lib/ConvertApi/Task.php | 6 +++--- tests/ConvertApi/ConvertApiTest.php | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/ConvertApi/Task.php b/lib/ConvertApi/Task.php index 6aa07e5..4542d63 100644 --- a/lib/ConvertApi/Task.php +++ b/lib/ConvertApi/Task.php @@ -16,11 +16,11 @@ function __construct($fromFormat, $toFormat, $params, $conversionTimeout = null) function run() { - $params = array_merge( - $this->normalizedParams(), + $params = array_replace( [ 'StoreFile' => true, - ] + ], + $this->normalizedParams() ); if ($this->conversionTimeout) { diff --git a/tests/ConvertApi/ConvertApiTest.php b/tests/ConvertApi/ConvertApiTest.php index 4429f40..04be985 100644 --- a/tests/ConvertApi/ConvertApiTest.php +++ b/tests/ConvertApi/ConvertApiTest.php @@ -77,6 +77,15 @@ public function testConvertWithFilePath() $this->assertEquals('test.pdf', $result->getFile()->getFileName()); } + public function testConvertWithStoreFileFalse() + { + $params = ['File' => 'examples/files/test.docx', 'StoreFile' => false]; + + $result = ConvertApi::convert('pdf', $params); + + $this->assertEquals('test.pdf', $result->getFile()->getFileName()); + } + public function testConvertWithAltnativeConverter() { $params = ['File' => 'examples/files/test.docx', 'converter' => 'openoffice'];