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.
This commit is contained in:
dargasea 2017-04-24 13:02:28 -07:00 committed by GitHub
parent 362ecdf843
commit 3de72c7f2f

View File

@ -69,7 +69,10 @@ function gen_name($arg, $in){
} }
switch($arg){ switch($arg){
case 'random': case 'random':
return $name.'.'.$in; if($in){
return $name.'.'.$in;
}
return $name;
break; break;
case 'custom_original': case 'custom_original':
return $name.'_'.$in; return $name.'_'.$in;