From 8fe7de7ff9cefb9a0cb692e66f4bd1ee47591394 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 25 Nov 2025 15:19:16 +1300 Subject: [PATCH] Custom disposition --- app/controllers/api/storage.php | 3 ++- src/Appwrite/Platform/Workers/Migrations.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 10fcbdb3d3..0aac690e3c 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -1509,6 +1509,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/push') } $isInternal = $decoded['internal'] ?? false; + $disposition = $decoded['disposition'] ?? 'inline'; $dbForProject = $isInternal ? $dbForPlatform : $dbForProject; $isAPIKey = Auth::isAppUser(Authorization::getRoles()); @@ -1565,7 +1566,7 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId/push') ->setContentType($contentType) ->addHeader('Content-Security-Policy', 'script-src none;') ->addHeader('X-Content-Type-Options', 'nosniff') - ->addHeader('Content-Disposition', 'inline; filename="' . $file->getAttribute('name', '') . '"') + ->addHeader('Content-Disposition', $disposition . '; filename="' . $file->getAttribute('name', '') . '"') ->addHeader('Cache-Control', 'private, max-age=3888000') // 45 days ->addHeader('X-Peak', \memory_get_peak_usage()); diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 59cb3c5f16..e7b12c5d9d 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -525,6 +525,7 @@ class Migrations extends Action 'fileId' => $fileId, 'projectId' => $project->getId(), 'internal' => true, + 'disposition' => 'attachment', ]); // Generate download URL with JWT