net2ftpのバグについて

net2ftp バージョン0.98にはSafariやIEでアクセスした際にダウンロードするファイル名がすべてindex.phpになってしまうバグがある。
この問題は下記でも指摘されているが修正されていない。
http://www.net2ftp.org/forums/viewtopic.php?id=2960

includes/filesystem.inc.php
を下記に修正

	header("Content-Type: " . $content_type);
	header("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
	if ($net2ftp_globals["browser_agent"] == "IE") {
		header("Content-Disposition: $content_disposition; filename=\"" . $filename_html . "\"");
		header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
		header("Pragma: public");
	}
//if ($net2ftp_globals["browser_platform"] == "Mac"){
if ($net2ftp_globals["browser_agent"] == "Safari" || $net2ftp_globals["browser_agent"] == "IE"){
    header("Content-type: application/force-download");
    header("Content-Transfer-Encoding: Binary");
    header("Content-disposition: attachment; filename=\"".$filename_html."\"");
    header("Content-Description: $filename_html");
    header("Content-Length: $filesize");
    header("Connection: close");
    } else {
		// Firefox needs an asterisk to enable filenames with special characters
		header("Content-Disposition: $content_disposition; filename*=\"" . $filename_html . "\"");
		header("Pragma: no-cache");
	}

	header("Content-Description: $filename_html");
	header("Content-Length: $filesize");
	header("Connection: close");

} // End function sendDownloadHeaders

フォーラムでは

if ($net2ftp_globals["browser_platform"] == "Mac"){

としているけど、WindowsのSafariでも再現するどころか、IE7、IE8でも再現するので

if ($net2ftp_globals["browser_agent"] == "Safari" || $net2ftp_globals["browser_agent"] == "IE"){

とした。

  1. コメントはまだありません。

  1. トラックバックはまだありません。