Issue 158: Previewing a file using a SCM that does not have file info throws exception

This commit is contained in:
Nathan Adams 2016-05-01 15:58:22 -05:00
parent 5d37f6fa6c
commit 0a15874ea1

View File

@ -213,7 +213,7 @@ class IDF_Views_Source
$commit, $scm);
$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)) {
(!IDF_FileUtil::isImage($info) && property_exists($request_file_info, "size") && $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].'"';