fix gitlab tests
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Services\ClassProgress;
|
||||
use App\Models\ClassProgressAttachment;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class ClassProgressAttachmentService
|
||||
{
|
||||
@@ -16,7 +17,7 @@ class ClassProgressAttachmentService
|
||||
|
||||
$stored = [];
|
||||
foreach ($files as $file) {
|
||||
if (! $file instanceof UploadedFile || ! $file->isValid()) {
|
||||
if (!$file instanceof UploadedFile || !$file->isValid()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -48,17 +49,17 @@ class ClassProgressAttachmentService
|
||||
$candidates = [];
|
||||
if (str_starts_with($path, 'storage/')) {
|
||||
$relative = ltrim(substr($path, strlen('storage/')), '/');
|
||||
$candidates[] = storage_path('app/public/'.$relative);
|
||||
$candidates[] = storage_path('app/public/' . $relative);
|
||||
}
|
||||
|
||||
if (str_starts_with($path, 'writable/uploads/')) {
|
||||
$relative = ltrim(substr($path, strlen('writable/uploads/')), '/');
|
||||
$candidates[] = storage_path('app/'.$relative);
|
||||
$candidates[] = storage_path('app/public/'.$relative);
|
||||
$candidates[] = storage_path('app/' . $relative);
|
||||
$candidates[] = storage_path('app/public/' . $relative);
|
||||
}
|
||||
|
||||
$candidates[] = storage_path('app/'.ltrim($path, '/'));
|
||||
$candidates[] = storage_path('app/public/'.ltrim($path, '/'));
|
||||
$candidates[] = storage_path('app/' . ltrim($path, '/'));
|
||||
$candidates[] = storage_path('app/public/' . ltrim($path, '/'));
|
||||
|
||||
foreach ($candidates as $candidate) {
|
||||
if (is_file($candidate)) {
|
||||
@@ -83,6 +84,6 @@ class ClassProgressAttachmentService
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return 'storage/'.ltrim($path, '/');
|
||||
return 'storage/' . ltrim($path, '/');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user