From 3de72c7f2fcac57b207b9446777ddbac567a4c99 Mon Sep 17 00:00:00 2001 From: dargasea Date: Mon, 24 Apr 2017 13:02:28 -0700 Subject: [PATCH] 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. --- includes/core.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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;