lesstif / php-jira-rest-client

PHP classes interact Jira with the REST API.
Other
510 stars 263 forks source link

Download filename should not be encoded #392

Closed jg-development closed 3 years ago

jg-development commented 3 years ago

Hi, if I download a file like "fooö.zip", the filename is after download "foo%C3B6.zip". This is because of this line in the AttachmentService:

        // extract filename
        $file = substr(strrchr($attachment->content, '/'), 1);

I am not sure why the filename is extracted from the url and not from the Attachment object. If the filename would be like:

$file = $attachment->filename;

... than the file would be correct downloaded. Can somebody help me here?

jg-development commented 3 years ago

https://github.com/lesstif/php-jira-rest-client/blob/657482c9df02e922d8a97e4c7e8ea75718818c28/src/JiraClient.php#L569

If we can change this line to:

$file = fopen($outDir.DIRECTORY_SEPARATOR.urldecode($file), 'w');

it works for me