Reduced code for filename trim

Signed-off-by: Magnus Walbeck <mw@mwalbeck.org>
This commit is contained in:
Magnus Walbeck 2017-01-23 17:14:39 +01:00
parent eadc1ac637
commit 3d99ec6832

View file

@ -169,9 +169,7 @@ class Detection implements IMimeTypeDetector {
$fileName = basename($path);
// remove leading dot on hidden files with a file extension
if (strpos($fileName, '.') === 0 && strpos($fileName, '.', 1)) {
$fileName = substr($fileName, 1);
}
$fileName = ltrim($fileName, '.');
// note: leading dot doesn't qualify as extension
if (strpos($fileName, '.') > 0) {