Page 1 of 1

getUploadDir uses / = not always correct

Posted: 2024-05-30 11:13
by onoehring
Hi,

I suggest in the function getUploadDir (in incFunctions.php) the following change (untested code)

Code: Select all

	function getUploadDir($dir = '') {
		if($dir == '') $dir = config('adminConfig')['baseUploadPath'];

$dir =  rtrim($dir, '\\/');
$dir =  rtrim($dir, '\\');
$dir .= DIRECTORY_SEPARATOR
return $dir;

	}
(changes lines moves to the left)

Why?
This code should produce a correct string for the operating system. PHP takes care of the wrong character (if used) but for our own string handling in own functions it would be easier to have the correct trailing character.

Olaf

Re: getUploadDir uses / = not always correct

Posted: 2024-06-01 11:38
by a.gneady
Sounds reasonable, Olaf. Will test it and include it in the next release. Thank you!

Re: getUploadDir uses / = not always correct

Posted: 2024-06-01 16:01
by onoehring
Hi,

Code: Select all

$dir =  rtrim($dir, '\\/');
Should probably be

Code: Select all

$dir =  rtrim($dir, '\/');
My bad
Olaf