From be622038be99d15b6c679856b2af571a7a2ccf8d Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sat, 10 Sep 2022 17:14:03 -0700
Subject: [PATCH] viewfile() now uses case-corrected file path

Sometimes files uploaded may have the wrong case in the filebase (a different
unresolved issue), but for instances where that has happened, make those files
viewable in sbbs. This really only impacts target OSes with case-sensitive
file systems (e.g. *nix).
---
 src/sbbs3/viewfile.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/viewfile.cpp b/src/sbbs3/viewfile.cpp
index 39df897a9b..1a0fbc9727 100644
--- a/src/sbbs3/viewfile.cpp
+++ b/src/sbbs3/viewfile.cpp
@@ -86,12 +86,14 @@ int sbbs_t::viewfile(file_t* f, bool ext)
 
 /*****************************************************************************/
 /*****************************************************************************/
-bool sbbs_t::viewfile(const char* path)
+bool sbbs_t::viewfile(const char* inpath)
 {
+	char	path[MAX_PATH + 1];
     char	viewcmd[256];
     int		i;
 
-	if(!fexist(path)) {
+	SAFECOPY(path, inpath);
+	if(!fexistcase(path)) {
 		bputs(text[FileNotFound]);
 		return false; 
 	}
-- 
GitLab