Merge pull request #10867 from appwrite/feat-jwt-disposition

Custom disposition
This commit is contained in:
Jake Barnby 2025-11-25 03:25:15 +00:00 committed by GitHub
commit c6e4afdb49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 12 deletions

View file

@ -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());

View file

@ -63,7 +63,7 @@
"utopia-php/locale": "0.8.*",
"utopia-php/logger": "0.6.*",
"utopia-php/messaging": "0.20.*",
"utopia-php/migration": "1.*",
"utopia-php/migration": "1.3.*",
"utopia-php/orchestration": "0.9.*",
"utopia-php/platform": "0.7.*",
"utopia-php/pools": "0.8.*",

18
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "dc4eb1888275a24d596468924e272e25",
"content-hash": "1d3d4b19a835b3be79a63146fcdd389b",
"packages": [
{
"name": "adhocore/jwt",
@ -4456,16 +4456,16 @@
},
{
"name": "utopia-php/migration",
"version": "1.4.0",
"version": "1.3.3",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "18bd7d39dcee09280f40edb12879c727ecec98d3"
"reference": "731b3a963c58c30e0b2368695d57a7e8fcb7455c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/18bd7d39dcee09280f40edb12879c727ecec98d3",
"reference": "18bd7d39dcee09280f40edb12879c727ecec98d3",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/731b3a963c58c30e0b2368695d57a7e8fcb7455c",
"reference": "731b3a963c58c30e0b2368695d57a7e8fcb7455c",
"shasum": ""
},
"require": {
@ -4505,9 +4505,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/migration/issues",
"source": "https://github.com/utopia-php/migration/tree/1.4.0"
"source": "https://github.com/utopia-php/migration/tree/1.3.3"
},
"time": "2025-11-21T06:08:59+00:00"
"time": "2025-10-28T04:02:08+00:00"
},
{
"name": "utopia-php/mongo",
@ -8893,7 +8893,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@ -8917,5 +8917,5 @@
"platform-overrides": {
"php": "8.3"
},
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.6.0"
}

View file

@ -525,6 +525,7 @@ class Migrations extends Action
'fileId' => $fileId,
'projectId' => $project->getId(),
'internal' => true,
'disposition' => 'attachment',
]);
// Generate download URL with JWT

View file

@ -1315,7 +1315,7 @@ trait MigrationsBase
$this->assertEquals('CSV', $response['body']['destination']);
return true;
}, 30000, 500);
}, 30_000, 500);
// Check that email was sent with download link
$lastEmail = $this->getLastEmail();