- Edited
Invalid File - is the response.
Request headers:
Content-Length: 5257
content-type: multipart/form-data; boundary=------multipartformboundary1677683054727
Invalid File - is the response.
Request headers:
Content-Length: 5257
content-type: multipart/form-data; boundary=------multipartformboundary1677683054727
KevinTheJedi
file --mime-type /home/erik/logopinguin.svg
/home/erik/logopinguin.svg: image/svg+xml
and from network tab:
Tried with same version PHP that Osticket is running:
echo mime_content_type('logopinguin.svg') . "\n";
image/svg+xml
This method is returning false:
So either the file couldn't be uploaded on the server (ie. no tmp_name
), the file type does not include image/
(which is not the case here), or the exif_imagetype does not pass. You can add some var_dump();
statements in that function to see what's missing or what's failing.
Cheers.
It seems to me that https://www.php.net/manual/en/function.exif-imagetype.php doesn't support .svg file type? Atleast I didn't find SVG file type in there.
static function isValidFile($file) {
// Check invalid image hacks
if ($file['tmp_name']
&& stripos($file['type'], 'image/') === 0
&& strpos(mime_content_type($file['tmp_name']), 'image/') === False) {
return false;
}
return true;
}
I changed the function and now it seems to work. I am not a programmer so if you have better solution then I am all ears But is it possible for you to look over this and maybe include it in next release?
Thank you for your help!!!
That's just a band-aid, not an actual fix. It may work for you but not how it's intended to work. So no, this will not be included in the next release.
Cheers.
Okay, but can Osticket include actual fix in the next release or consider it? Since svg file types are image types but current release doesn't accept it as this.
As far as I understand others should also have this issue?
Maybe you can check my hypothesis that https://www.php.net/manual/en/function.exif-imagetype.php function doesn't recognize .svg file types.
KevinTheJedi
Thank you, please do!
For now I have to roll with the band-aid fix