From 5b8c603124c4cc7b51eb70eaa95ff953b89054e1 Mon Sep 17 00:00:00 2001 From: lorilee Date: Mon, 12 Jul 2010 19:10:11 -0700 Subject: [PATCH] If the user already appended the file extension, don't add it again --- export.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/export.php b/export.php index 9c82ed11a..323932f5a 100644 --- a/export.php +++ b/export.php @@ -281,7 +281,13 @@ if ($asfile) { } // Grab basic dump extension and mime type - $filename .= '.' . $export_list[$type]['extension']; + // Check if the user already added extension; get the substring where the extension would be if it was included + $extension_start_pos = strlen($filename) - strlen($export_list[$type]['extension']) - 1; + $user_extension = substr($filename, $extension_start_pos, strlen($filename)); + $required_extension = "." . $export_list[$type]['extension']; + if(strtolower($user_extension) != $required_extension) { + $filename .= $required_extension; + } $mime_type = $export_list[$type]['mime_type']; // If dump is going to be compressed, set correct mime_type and add