From 8c1908a260f6d8058717b18859fc11d989fca256 Mon Sep 17 00:00:00 2001
From: Uma <uma.s@vtiger.com>
Date: Fri, 26 Jun 2020 18:19:48 +0530
Subject: [PATCH] Fixes #1321 File Preview is Comments is supported

---
 modules/Vtiger/models/Record.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/Vtiger/models/Record.php b/modules/Vtiger/models/Record.php
index 389812c11..90a10f673 100644
--- a/modules/Vtiger/models/Record.php
+++ b/modules/Vtiger/models/Record.php
@@ -744,8 +744,11 @@ class Vtiger_Record_Model extends Vtiger_Base_Model {
         
         function getDownloadFileURL($attachmentId = false) {
             $fileDetails = $this->getFileDetails($attachmentId);
+            if (is_array($fileDetails[0])) {
+                $fileDetails = $fileDetails[0];
+            }
             if (!empty($fileDetails)) {
-                    return 'index.php?module='. $this->getModuleName() .'&action=DownloadFile&record='. $this->getId() .'&fileid='. $fileDetails[0]['attachmentsid'].'&name='. $fileDetails[0]['name'];
+                    return 'index.php?module='. $this->getModuleName() .'&action=DownloadFile&record='. $this->getId() .'&fileid='. $fileDetails['attachmentsid'].'&name='. $fileDetails['name'];
             } else {
                     return $this->get('filename');
             }
-- 
GitLab