Merge pull request #51 from kijin/pr/stupid-symlinks

Zip으로 다운받은 경우 압축 스크립트가 깨지는 문제 수정
This commit is contained in:
Kijin Sung 2016-01-12 11:10:49 +09:00
commit c39706c480
2 changed files with 12 additions and 1 deletions

View file

@ -183,7 +183,8 @@ class FrontEndFileHandler extends Handler
$originalFilePath = $file->fileRealPath . '/' . $pathInfo['basename'];
// Fix incorrectly minified URL
if($file->isMinified && !$file->isExternalURL && (!file_exists($originalFilePath) || is_link($originalFilePath)))
if($file->isMinified && !$file->isExternalURL && (!file_exists($originalFilePath) || is_link($originalFilePath) ||
(filesize($originalFilePath) < 32 && trim(file_get_contents($originalFilePath)) === $file->keyName)))
{
if(file_exists($file->fileRealPath . '/' . $file->fileNameNoExt . '.' . $file->fileExtension))
{

View file

@ -21,6 +21,16 @@ if(jQuery) jQuery.noConflict();
($.os.Unix) ? 'Unix' :
($.os.Mac) ? 'Mac' : '';
/* Intercept getScript error due to broken minified script URL */
$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
if(settings.dataType === "script" && (jqxhr.status >= 400 || (jqxhr.responseText && jqxhr.responseText.length < 32))) {
var match = /^(.+)\.min\.(css|js)($|\?)/.exec(settings.url);
if(match) {
$.getScript(match[1] + "." + match[2], settings.success);
}
}
});
/**
* @brief XE 공용 유틸리티 함수
* @namespace XE