Merged in bugfix/PMC-1297 (pull request #7096)
PMC-1297 Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\unit\workflow\engine\src\ProcessMaker\Util\Helpers;
|
||||
|
||||
use Tests\TestCase;
|
||||
|
||||
class FixContentDispositionFilenameTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* It tests that the special characters are being replaced
|
||||
* @test
|
||||
*/
|
||||
public function it_should_test_the_special_characters_located_in_a_filename()
|
||||
{
|
||||
//The file name send to the function
|
||||
$fileName = "text\"text ?text/text";
|
||||
//Calling the fixContentDispositionFilename() function
|
||||
$res = fixContentDispositionFilename($fileName);
|
||||
//Assert the special characters where replaced with the correct values
|
||||
$this->assertEquals('texttext _text_text', $res);
|
||||
}
|
||||
}
|
||||
@@ -488,10 +488,12 @@ function changeAbbreviationOfDirectives($size)
|
||||
function fixContentDispositionFilename($fileName, $replacement = '_')
|
||||
{
|
||||
//(double quote) has to be removed
|
||||
//(question mark) has to be replaced by underscore due to the issue in google chrome
|
||||
//(forward slash) has to replaced by underscore
|
||||
//(backslash) has to replaced by underscore
|
||||
$default = [
|
||||
'/[\"]/' => '',
|
||||
'/[\?]/' => $replacement,
|
||||
'/[\\|\/]/' => $replacement,
|
||||
'/\\\\/' => $replacement
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user