Skip to content

Commit 6c1e50a

Browse files
committed
fix: backup downloads
1 parent da064de commit 6c1e50a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

routes/web.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@
233233
Route::post('/upload/backup/{databaseUuid}', [UploadController::class, 'upload'])->name('upload.backup');
234234
Route::get('/download/backup/{executionId}', function () {
235235
try {
236+
ray()->clearAll();
236237
$team = auth()->user()->currentTeam();
237238
if (is_null($team)) {
238239
return response()->json(['message' => 'Team not found.'], 404);
@@ -264,14 +265,18 @@
264265
'port' => $server->port,
265266
'username' => $server->user,
266267
'privateKey' => $privateKeyLocation,
268+
'root' => '/',
267269
]);
270+
if (! $disk->exists($filename)) {
271+
return response()->json(['message' => 'Backup not found.'], 404);
272+
}
268273

269274
return new StreamedResponse(function () use ($disk, $filename) {
270275
if (ob_get_level()) {
271276
ob_end_clean();
272277
}
273278
$stream = $disk->readStream($filename);
274-
if ($stream === false) {
279+
if ($stream === false || is_null($stream)) {
275280
abort(500, 'Failed to open stream for the requested file.');
276281
}
277282
while (! feof($stream)) {

0 commit comments

Comments
 (0)