Skip to content

Commit 79754a6

Browse files
Normalize mixed path separators from Storage::path() on Windows
1 parent 9f967fc commit 79754a6

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

lorefire-desktop/app/Http/Controllers/ChunkedAudioController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function importAudio(Request $request, GameSession $session): JsonRespons
3131
Storage::disk('local')->delete($session->audio_path);
3232
}
3333

34-
$absPath = Storage::disk('local')->path($finalPath);
34+
$absPath = str_replace('/', DIRECTORY_SEPARATOR, Storage::disk('local')->path($finalPath));
3535

3636
if (!is_dir(dirname($absPath))) {
3737
mkdir(dirname($absPath), 0755, true);
@@ -59,7 +59,7 @@ public function downloadAudio(GameSession $session): \Symfony\Component\HttpFoun
5959
return response()->json(['error' => 'No audio file found for this session.'], 404);
6060
}
6161

62-
$absPath = Storage::disk('local')->path($session->audio_path);
62+
$absPath = str_replace('/', DIRECTORY_SEPARATOR, Storage::disk('local')->path($session->audio_path));
6363
$extension = pathinfo($session->audio_path, PATHINFO_EXTENSION);
6464
$filename = Str::slug($session->title) . '-session-' . ($session->session_number ?? $session->id) . '.' . $extension;
6565

@@ -163,7 +163,7 @@ public function finalize(Request $request, GameSession $session): JsonResponse
163163
};
164164

165165
$finalPath = "sessions/{$session->id}/audio.{$extension}";
166-
$absPath = Storage::disk('local')->path($finalPath);
166+
$absPath = str_replace('/', DIRECTORY_SEPARATOR, Storage::disk('local')->path($finalPath));
167167

168168
// Ensure the sessions directory exists
169169
if (!is_dir(dirname($absPath))) {
@@ -177,7 +177,7 @@ public function finalize(Request $request, GameSession $session): JsonResponse
177177
}
178178

179179
foreach ($files as $relPath) {
180-
$absChunk = Storage::disk('local')->path($relPath);
180+
$absChunk = str_replace('/', DIRECTORY_SEPARATOR, Storage::disk('local')->path($relPath));
181181
$in = fopen($absChunk, 'rb');
182182
if ($in) {
183183
stream_copy_to_stream($in, $out);

lorefire-desktop/app/Jobs/TranscribeAudio.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ public function handle(): void
6565
$this->session->update(['transcription_status' => 'processing']);
6666
$this->writeProgress('Starting…', 0);
6767

68-
$audioPath = Storage::path($this->session->audio_path);
69-
$outputDir = Storage::path("sessions/{$this->session->id}/transcript");
70-
$transcriptJson = $outputDir . DIRECTORY_SEPARATOR . 'transcript.json';
68+
$audioPath = str_replace('/', DIRECTORY_SEPARATOR, Storage::path($this->session->audio_path));
69+
$transcriptJson = str_replace('/', DIRECTORY_SEPARATOR, Storage::path("sessions/{$this->session->id}/transcript/transcript.json"));
7170

7271
$model = \App\Models\AppSetting::get('whisperx_model', 'base');
7372
$language = \App\Models\AppSetting::get('whisperx_language', 'en');

0 commit comments

Comments
 (0)