Squirrelmail: Attachments download as “download.php” when using 2-byte interface


When downloading an attachment from the Squirrelmail webmail interface, the downloaded file’s filename remains as “download.php” instead of being renamed to the correct filename. This only happens when a 2-byte character language interface is selected from “Options > Display options”.


When using a 2-byte language interface, the encoding and decoding of the attachment filename is passed through the i18n.php logic. The particular code detects the users’ CPU platform and passes along the decoding to a function accordingly. The code in “functions/i18n.php” has an error where the CPU detection string uses “Mac_” instead of “Mac”. “Mac_” only applies to MSIE. It is very likely that the programmers of i18n.php has only tested this code using MSIE and not Safari or a Mozilla variant.


Edit “functions/i18n.php” around line 630. Change:

strstr($useragent, 'Mac_') !== false) {
strstr($useragent, 'Mac') !== false) {
*** This method has not worked consistently throughout version updates. Please make a backup of the original file before proceeding. ***