From 34fecdbdf7663038c3bf3a3d9d0f9b8598ab4df7 Mon Sep 17 00:00:00 2001 From: taggon Date: Wed, 1 Dec 2010 08:41:55 +0000 Subject: [PATCH] =?UTF-8?q?#19297423=20Firefox=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=9D=BC=EB=B6=80=20=EC=9C=A0=EB=8B=88=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EB=AA=85=EC=9D=84=20=EA=B0=80=EC=A7=84=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=EC=9D=84=20=EC=97=85=EB=A1=9C=EB=93=9C?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EB=AA=BB=ED=95=98=EB=8A=94=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95=20(Workaround)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7948 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- common/js/plugins/uploader/uploader.js | 4 +++- modules/file/file.controller.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/common/js/plugins/uploader/uploader.js b/common/js/plugins/uploader/uploader.js index 40d32a7a2..0bb08e640 100644 --- a/common/js/plugins/uploader/uploader.js +++ b/common/js/plugins/uploader/uploader.js @@ -364,8 +364,10 @@ runtimes.html5 = { data += val+'\r\n'; }); + // Firefox has a bug that regonises some unicode filename as invalid string. + // So, I make a workaround for it encoding the filename applying RFC2231 data += '--'+bndr+'\r\n'; - data += 'Content-Disposition: form-data; name="Filedata"; filename="'+file.name+'"\r\n'; + data += 'Content-Disposition: form-data; name="Filedata"; filename="=?UTF-8?B?'+Base64.encode(file.name)+'?="\r\n'; data += 'Content-Type: application/octet-stream\r\n\r\n'; data += file.object.getAsBinary(); data += '\r\n'; diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index eca656d8c..49c9d6acb 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -375,6 +375,9 @@ $trigger_obj->upload_target_srl = $upload_target_srl; $output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); if(!$output->toBool()) return $output; + + // A workaround for Firefox upload bug + if (preg_match('/^=\?UTF-8\?B\?(.+)\?=$/i', $file_info['name'], $match)) $file_info['name'] = base64_decode($match[1]); if(!$manual_insert) { // 첨부파일 설정 가져옴