From: dargasea Date: Mon, 24 Apr 2017 20:02:28 +0000 (-0700) Subject: Ensure no trailing dot in random filenames X-Git-Tag: v1.0~72^2 X-Git-Url: https://jfr.im/git/uguu.git/commitdiff_plain/3de72c7f2fcac57b207b9446777ddbac567a4c99 Ensure no trailing dot in random filenames This commit solves the issue that, if the uploaded file does not have an extension, there will be a "." at the end of the generated name. This would not be ideal as the dot is often omitted when links are automatically hyperlinked elsewhere. --- diff --git a/includes/core.php b/includes/core.php index 2321a2e..5e91547 100644 --- a/includes/core.php +++ b/includes/core.php @@ -69,7 +69,10 @@ function gen_name($arg, $in){ } switch($arg){ case 'random': - return $name.'.'.$in; + if($in){ + return $name.'.'.$in; + } + return $name; break; case 'custom_original': return $name.'_'.$in;