diff options
author | infoneo <infoneo@yahoo.pl> | 2013-05-12 15:22:57 +0300 |
---|---|---|
committer | infoneo <infoneo@yahoo.pl> | 2013-05-12 15:22:57 +0300 |
commit | be4eef682ae515fd542ec351eef05cc54fe3247c (patch) | |
tree | e8d4449d1ffe2b5e0dcb924d94054c72c2941007 | |
parent | 8f19c5ecab7058702882aa3db4d3202ca697cb70 (diff) | |
download | nextcloud-server-be4eef682ae515fd542ec351eef05cc54fe3247c.tar.gz nextcloud-server-be4eef682ae515fd542ec351eef05cc54fe3247c.zip |
Fixed problems with a dots in a filenames
-rw-r--r-- | lib/files/mapper.php | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/lib/files/mapper.php b/lib/files/mapper.php index 97a2bff915a..d9e116bf25b 100644 --- a/lib/files/mapper.php +++ b/lib/files/mapper.php @@ -176,16 +176,22 @@ class Mapper $last= end($pathElements); $parts = pathinfo($last); - if ((preg_match('~[-\w]+~', $parts['filename'])) && (preg_match('~[-\w]+~', $parts['extension']))){ + $filename = $parts['filename']; + $extension = $parts['extension']; + + + if ((preg_match('~[-\w]+~', $filename)) && (preg_match('~[-\w]+~', $extension))){ - // rip off the extension ext from last element - $filename = $parts['filename']; - array_pop($pathElements); - array_push($pathElements, $filename); + // rip off the extension ext from last element + array_pop($pathElements); + array_push($pathElements, $filename); } else { - unset($parts['extension']); + if (isset($parts['extension'])) { + unset($parts['extension']); + } + } foreach ($pathElements as $pathElement) { |