Handle moving files when casing is a problem
This commit is contained in:
parent
5799ec3281
commit
94d0125c6d
|
@ -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(
|
||||
|
|
Loading…
Reference in New Issue
Block a user