From 0208797b632606e04e0fb0ed8c6d5b0acafaa530 Mon Sep 17 00:00:00 2001
From: Prasad <prasad@vtiger.com>
Date: Sat, 13 Jul 2024 19:43:52 +0530
Subject: [PATCH] Fixed document file-upload derived filename

---
 modules/Documents/Documents.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/Documents/Documents.php b/modules/Documents/Documents.php
index 4135d61a7..f1b2e4db4 100644
--- a/modules/Documents/Documents.php
+++ b/modules/Documents/Documents.php
@@ -183,9 +183,9 @@ class Documents extends CRMEntity {
 
 		foreach($_FILES as $fileindex => $files)
 		{
-			if($files['name'] != '' && $files['size'] > 0 && isset($_REQUEST[$fileindex.'_hidden']))
+			if($files['name'] != '' && $files['size'] > 0)
 			{
-				$files['original_name'] = isset($_REQUEST[$fileindex.'_hidden']) ? vtlib_purify($_REQUEST[$fileindex.'_hidden']) : "";
+				$files['original_name'] = isset($_REQUEST[$fileindex.'_hidden']) ? vtlib_purify($_REQUEST[$fileindex.'_hidden']) : stripslashes($files['name']);
 				$file_saved = $this->uploadAndSaveFile($id,$module,$files);
                                 if(!$file_saved){
                                     $log->debug('file upload failed');
-- 
GitLab