]> jfr.im git - uguu.git/commitdiff
Ensure no trailing dot in random filenames
authordargasea <redacted>
Mon, 24 Apr 2017 20:02:28 +0000 (13:02 -0700)
committerGitHub <redacted>
Mon, 24 Apr 2017 20:02:28 +0000 (13:02 -0700)
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

index 2321a2eaaf977e95e964fad852049078c3d24415..5e915478074103c83c7efd21f2a5769c67619019 100644 (file)
@@ -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;