Fix readFiles method to add missing slash in file path for correct .txt file filtering
This commit is contained in:
@@ -62,10 +62,13 @@ class SapFileController extends Controller
|
|||||||
// return $file !== '.' && $file !== '..' && is_file($path . $file)
|
// return $file !== '.' && $file !== '..' && is_file($path . $file)
|
||||||
// && pathinfo($file, PATHINFO_EXTENSION) === 'txt';
|
// && pathinfo($file, PATHINFO_EXTENSION) === 'txt';
|
||||||
// });
|
// });
|
||||||
$files = array_filter($allFiles, function($item) use ($path) {
|
$files = array_filter(scandir($path), function($item) use ($path) {
|
||||||
$fullPath = $path . '/' . $item; // Add the missing slash
|
$fullPath = $path . '/' . $item; // ✅ Add missing slash
|
||||||
return is_file($fullPath) && pathinfo($item, PATHINFO_EXTENSION) === 'txt';
|
return is_file($fullPath) && pathinfo($item, PATHINFO_EXTENSION) == 'txt';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (empty($files)) {
|
if (empty($files)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
|
|||||||
Reference in New Issue
Block a user