diff --git a/indefero/src/IDF/Views/Source.php b/indefero/src/IDF/Views/Source.php index abb584a..6c1a5a4 100644 --- a/indefero/src/IDF/Views/Source.php +++ b/indefero/src/IDF/Views/Source.php @@ -211,7 +211,9 @@ class IDF_Views_Source if ($request_file_info->type != 'tree') { $info = self::getRequestedFileMimeType($request_file_info, $commit, $scm); - if (!IDF_FileUtil::isText($info) && !IDF_FileUtil::isImage($info)) { + $previewSizeLimit = Pluf::f("preview_size_limit", 2000000); + if (!IDF_FileUtil::isText($info) && !IDF_FileUtil::isImage($info) || + (!IDF_FileUtil::isImage($info) && $request_file_info->size >= $previewSizeLimit)) { $rep = new Pluf_HTTP_Response($scm->getFile($request_file_info), $info[0]); $rep->headers['Content-Disposition'] = 'attachment; filename="'.$info[1].'"';