Skip to content

Commit 9d3136f

Browse files
iqbalhasandevgithub-actions[bot]
authored andcommitted
Fix styling
1 parent b85a995 commit 9d3136f

File tree

5 files changed

+94
-103
lines changed

5 files changed

+94
-103
lines changed

src/Http/Controllers/FilexController.php

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class FilexController extends Controller
4141
/**
4242
* Cache size limits (removed unused constant)
4343
*/
44-
4544
public function __construct(FilexService $filexService)
4645
{
4746
$this->filexService = $filexService;
@@ -167,8 +166,8 @@ protected function handleChunkedUpload(Request $request, $file): JsonResponse
167166
$originalFileName = $file->getClientOriginalName();
168167

169168
// Create temp directory for chunks with proper permissions
170-
$tempDir = 'temp/chunks/' . $uuid;
171-
$chunkPath = $tempDir . '/chunk_' . $chunkIndex;
169+
$tempDir = 'temp/chunks/'.$uuid;
170+
$chunkPath = $tempDir.'/chunk_'.$chunkIndex;
172171
$tempDisk = $this->getTempDisk();
173172

174173
try {
@@ -256,7 +255,7 @@ public function deleteTempFile(Request $request, string $filename): JsonResponse
256255
{
257256
try {
258257
// Reconstruct the temp path from the filename
259-
$tempPath = 'temp/' . $filename;
258+
$tempPath = 'temp/'.$filename;
260259

261260
// Security check - ensure file is in temp directory and filename is valid
262261
if (
@@ -304,7 +303,7 @@ public function deleteTempFile(Request $request, string $filename): JsonResponse
304303
'timestamp' => now()->toISOString(),
305304
]);
306305
} catch (\Exception $e) {
307-
Log::error('Temp file deletion error: ' . $e->getMessage(), [
306+
Log::error('Temp file deletion error: '.$e->getMessage(), [
308307
'temp_path' => $request->input('tempPath'),
309308
'filename' => $filename,
310309
'user_id' => Auth::check() ? Auth::id() : null,
@@ -326,7 +325,7 @@ public function deleteTempFile(Request $request, string $filename): JsonResponse
326325
public function getTempFileInfo(Request $request, string $filename): JsonResponse
327326
{
328327
// Reconstruct the temp path from the filename
329-
$tempPath = 'temp/' . $filename;
328+
$tempPath = 'temp/'.$filename;
330329

331330
// Security check - ensure file is in temp directory and filename is valid
332331
if (
@@ -388,7 +387,7 @@ protected function mergeChunksStreaming(string $tempDir, string $finalPath, int
388387

389388
try {
390389
for ($i = 0; $i < $totalChunks; $i++) {
391-
$chunkFile = $tempDir . '/chunk_' . $i;
390+
$chunkFile = $tempDir.'/chunk_'.$i;
392391

393392
if ($tempDisk->exists($chunkFile)) {
394393
$chunkFullPath = $tempDisk->path($chunkFile);
@@ -467,7 +466,7 @@ public function getUploadConfig(): JsonResponse
467466
'max_execution_time' => ini_get('max_execution_time'),
468467
],
469468
'app_settings' => [
470-
'max_file_size' => ConfigHelper::getMaxFileSize() / (1024 * 1024) . 'MB',
469+
'max_file_size' => ConfigHelper::getMaxFileSize() / (1024 * 1024).'MB',
471470
'performance_memory_limit' => ConfigHelper::get('performance.memory_limit'),
472471
'performance_time_limit' => ConfigHelper::get('performance.time_limit'),
473472
'temp_disk' => ConfigHelper::getTempDisk(),
@@ -605,7 +604,7 @@ public function uploadBulk(Request $request): JsonResponse
605604
]);
606605
}
607606

608-
$successCount = count(array_filter($results, fn($r) => $r['success']));
607+
$successCount = count(array_filter($results, fn ($r) => $r['success']));
609608
$failCount = count($results) - $successCount;
610609

611610
PerformanceMonitor::endTimer('bulk_upload', [
@@ -711,7 +710,7 @@ protected function validateBasicUploadFile($file): array
711710
public function deleteTempDirectory(Request $request, string $uuid): JsonResponse
712711
{
713712
try {
714-
$tempDir = 'temp/chunks/' . $uuid;
713+
$tempDir = 'temp/chunks/'.$uuid;
715714

716715
// Security check - ensure directory is valid
717716
if (
@@ -749,7 +748,7 @@ public function deleteTempDirectory(Request $request, string $uuid): JsonRespons
749748
'timestamp' => now()->toISOString(),
750749
]);
751750
} catch (\Exception $e) {
752-
Log::error('Temp directory deletion error: ' . $e->getMessage(), [
751+
Log::error('Temp directory deletion error: '.$e->getMessage(), [
753752
'uuid' => $uuid,
754753
'user_id' => Auth::check() ? Auth::id() : null,
755754
'exception' => $e->getTraceAsString(),
@@ -941,7 +940,7 @@ protected function errorResponse(string $message, int $code = 500, ?string $erro
941940
*/
942941
protected function handleUploadError(\Exception $e, $request): JsonResponse
943942
{
944-
Log::error('File upload error: ' . $e->getMessage(), [
943+
Log::error('File upload error: '.$e->getMessage(), [
945944
'exception' => $e,
946945
'request' => $request->all(),
947946
'user_id' => Auth::id(),
@@ -1200,7 +1199,7 @@ private function updateUploadProgress(int $bytesWritten, int $totalSize): void
12001199
];
12011200

12021201
Cache::put(
1203-
'upload_progress_' . request()->input('dzuuid'),
1202+
'upload_progress_'.request()->input('dzuuid'),
12041203
$progress,
12051204
now()->addMinutes(5)
12061205
);
@@ -1237,9 +1236,9 @@ private function logUploadMetrics(
12371236
'chunk_index' => $chunkIndex + 1,
12381237
'total_chunks' => $totalChunks,
12391238
'size' => ByteHelper::formatBytes($size),
1240-
'duration' => $duration . 's',
1239+
'duration' => $duration.'s',
12411240
'memory_used' => ByteHelper::formatBytes($memoryUsed),
1242-
'throughput' => ByteHelper::formatBytes((int) ($size / $duration)) . '/s',
1241+
'throughput' => ByteHelper::formatBytes((int) ($size / $duration)).'/s',
12431242
]);
12441243
}
12451244

@@ -1249,7 +1248,7 @@ private function logUploadMetrics(
12491248
private function getUploadedChunksCount(string $tempDir): int
12501249
{
12511250
return collect($this->getTempDisk()->files($tempDir))
1252-
->filter(fn($file) => str_contains($file, 'chunk_'))
1251+
->filter(fn ($file) => str_contains($file, 'chunk_'))
12531252
->count();
12541253
}
12551254

@@ -1268,7 +1267,7 @@ private function finalizeChunkedUpload(
12681267

12691268
// Generate final filename
12701269
$finalFileName = $this->filexService->generateFileName($originalFileName);
1271-
$finalPath = 'temp/' . $finalFileName;
1270+
$finalPath = 'temp/'.$finalFileName;
12721271

12731272
// Merge chunks with optimized streaming
12741273
$this->mergeChunksStreaming($tempDir, $finalPath, $totalChunks);

src/Http/Middleware/FileUploadSecurityMiddleware.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private function getRateLimitKey(Request $request): string
158158
$sessionId = '';
159159
}
160160

161-
return 'filex_upload:' . md5($ip . $sessionId);
161+
return 'filex_upload:'.md5($ip.$sessionId);
162162
}
163163

164164
/**
@@ -332,7 +332,7 @@ private function detectSuspiciousPatterns(Request $request): bool
332332
foreach ($suspiciousPatterns as $pattern) {
333333
// Use preg_quote to safely escape the pattern
334334
$escapedPattern = preg_quote($pattern, '/');
335-
if (preg_match('/' . $escapedPattern . '/i', implode(' ', $header))) {
335+
if (preg_match('/'.$escapedPattern.'/i', implode(' ', $header))) {
336336
return true;
337337
}
338338
}

0 commit comments

Comments
 (0)