From b1acd3fee031d9ec36e81f5ce27ec9bf05f603e7 Mon Sep 17 00:00:00 2001 From: shixuesen Date: Thu, 11 Aug 2022 19:52:14 +0800 Subject: [PATCH] fix file extensioon --- app/Services/FileService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Services/FileService.php b/app/Services/FileService.php index 39f1e66..9ad8984 100644 --- a/app/Services/FileService.php +++ b/app/Services/FileService.php @@ -1206,7 +1206,7 @@ class FileService { } if (is_file($currentItem)) { $pathInfo = pathinfo($currentItem); - if (in_array($pathInfo[PATHINFO_EXTENSION], $extensions)) { + if (in_array($pathInfo["extension"], $extensions)) { dump("now delete file $currentItem"); unlink($currentItem); } @@ -1231,7 +1231,7 @@ class FileService { } if (is_file($currentItem)) { $pathInfo = pathinfo($currentItem); - if ($pathInfo[PATHINFO_EXTENSION] == $fromExtension) { + if ($pathInfo["extension"] == $fromExtension) { $newFile = str_replace($fromExtension, $toExtension, $currentItem); dump("now rename file $currentItem to $newFile"); rename($currentItem, $newFile); @@ -1246,7 +1246,7 @@ class FileService { { if (is_file($file)) { $pathInfo = pathinfo($file); - if ($pathInfo[PATHINFO_EXTENSION] == $fromExtension) { + if ($pathInfo["extension"] == $fromExtension) { $newFile = str_replace($fromExtension, $toExtension, $file); dump("now rename file $file to $newFile"); rename($file, $newFile);