From 47514ca2df301631bf9ee2043e347f95f11f57da Mon Sep 17 00:00:00 2001
From: Cesar G <prototech91@gmail.com>
Date: Fri, 10 Apr 2015 16:23:51 -0700
Subject: [PATCH] [ticket/13755] Ignore dots in path when determining file
 extension.

PHPBB3-13755
---
 phpBB/includes/functions_upload.php | 2 ++
 tests/upload/filespec_test.php      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index f179b2fd70..89bc31fa25 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -213,6 +213,8 @@ class filespec
 	*/
 	static public function get_extension($filename)
 	{
+		$filename = utf8_basename($filename);
+
 		if (strpos($filename, '.') === false)
 		{
 			return '';
diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php
index 05547dcd00..ed28bcb38f 100644
--- a/tests/upload/filespec_test.php
+++ b/tests/upload/filespec_test.php
@@ -213,6 +213,8 @@ class phpbb_filespec_test extends phpbb_test_case
 			array('file.phpbb.gif', 'gif'),
 			array('file..', ''),
 			array('.file..jpg.webp', 'webp'),
+			array('/test.com/file', ''),
+			array('/test.com/file.gif', 'gif'),
 		);
 	}