1
0

Handle moving files when casing is a problem

This commit is contained in:
Richard Dern 2024-04-23 11:58:34 +02:00
parent 5799ec3281
commit 94d0125c6d

View File

@ -3,6 +3,7 @@
namespace App\Classes\Traits\Repairs;
use Carbon\Carbon;
use Illuminate\Support\Str;
use Intervention\Image\Laravel\Facades\Image;
/**
@ -60,7 +61,12 @@ private function repairKnownImage(string $ref, array $data)
}
if ($currentFullPath !== $expectedFullPath) {
$this->disk->move($currentFullPath, $expectedFullPath);
$filename = pathinfo($currentFullPath, PATHINFO_BASENAME);
$tempname = Str::random(6);
$tempPath = str_replace($filename, $tempname, $currentFullPath);
$this->disk->move($currentFullPath, $tempPath);
$this->disk->move($tempPath, $expectedFullPath);
$data['last_modified'] = Carbon::parse($this->disk->lastModified($expectedFullPath))->toIso8601String();
$data['filename'] = sprintf(