mirror of
https://github.com/silverstripe/silverstripe-textextraction
synced 2024-10-22 09:06:00 +00:00
Check file existence in for_file()
finfo() will silently fail the whole request (at least on my PHP 5.4 install) if invoked on a file that doesn't exist, so fail early here.
This commit is contained in:
parent
15f9647bca
commit
da6c554acb
@ -72,9 +72,13 @@ abstract class FileTextExtractor extends Object {
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
* @return FileTextExtractor
|
||||
* @return FileTextExtractor|null
|
||||
*/
|
||||
static function for_file($path) {
|
||||
if(!file_exists($path) || is_dir($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$extension = pathinfo($path, PATHINFO_EXTENSION);
|
||||
$mime = self::get_mime($path);
|
||||
foreach(self::get_extractor_classes() as $className) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user