forked from loafle/openapi-generator-original
[PHP] Add path & file separator (/) to return the correct path when deserializing a file (#7671)
* Add path & file separator (/) to return the correct path Add the separator between the tempFolderPath and the sanitized filename so that the path to the file is correct. (Fixes #7670) * Remove separator from generated file * Add separator Add the separator between the tempFolderPath and the sanitized filename so that the path to the file is correct. (Fixes #7670) * Update sample code Via ./bin/php-petstore.sh
This commit is contained in:
parent
8e0a0ebd62
commit
3bcf0ff764
@ -261,7 +261,7 @@ class ObjectSerializer
|
|||||||
// determine file name
|
// determine file name
|
||||||
if (array_key_exists('Content-Disposition', $httpHeaders) &&
|
if (array_key_exists('Content-Disposition', $httpHeaders) &&
|
||||||
preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
|
preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
|
||||||
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . self::sanitizeFilename($match[1]);
|
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]);
|
||||||
} else {
|
} else {
|
||||||
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
|
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ class ObjectSerializer
|
|||||||
// determine file name
|
// determine file name
|
||||||
if (array_key_exists('Content-Disposition', $httpHeaders) &&
|
if (array_key_exists('Content-Disposition', $httpHeaders) &&
|
||||||
preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
|
preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
|
||||||
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . self::sanitizeFilename($match[1]);
|
$filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]);
|
||||||
} else {
|
} else {
|
||||||
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
|
$filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
|
|
||||||
<filter>
|
<filter>
|
||||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||||
<directory suffix=".php">./lib/Api</directory>
|
<directory suffix=".php">./lib\Api</directory>
|
||||||
<directory suffix=".php">./lib/Model</directory>
|
<directory suffix=".php">./lib\Model</directory>
|
||||||
</whitelist>
|
</whitelist>
|
||||||
</filter>
|
</filter>
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user