Added method to check file extension

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2025-05-15 17:02:16 +02:00
parent 5e1ee05e19
commit 35b47cd57f
+12 -1
View File
@@ -50,15 +50,26 @@ class StorageHelper
'png',
];
// The file exists and is allowed to be displayed inline
if (Storage::exists($file_with_path) && (in_array(pathinfo($file_with_path, PATHINFO_EXTENSION), $allowed_inline))) {
return true;
}
return false;
}
public static function getFiletype($file_with_path) {
// The file exists and is allowed to be displayed inline
if (Storage::exists($file_with_path)) {
return pathinfo($file_with_path, PATHINFO_EXTENSION);
}
return null;
}
/**
* Decide whether to show the file inline or download it.
*/