mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 15:21:22 +02:00
fix: add missing bootstrap require in markdown-cheatsheet-fragment.php, add bottom padding to dialog
This commit is contained in:
@@ -108,10 +108,7 @@ class MediaController
|
||||
exit;
|
||||
}
|
||||
|
||||
// 5. Determine if download was explicitly requested
|
||||
$forceDownload = !empty($_GET['download']) && $_GET['download'] === '1';
|
||||
|
||||
// 6. Send response headers
|
||||
// 5. Send response headers
|
||||
header('Content-Type: ' . $mimeType);
|
||||
header('Content-Length: ' . (int) filesize($realFull));
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
@@ -121,12 +118,10 @@ class MediaController
|
||||
header('Cache-Control: public, max-age=86400');
|
||||
} elseif (in_array($ext, ['jpg','jpeg','png','gif','webp'], true)) {
|
||||
header('Cache-Control: public, max-age=604800');
|
||||
if (!$forceDownload) {
|
||||
header('Content-Disposition: inline');
|
||||
}
|
||||
header('Content-Disposition: inline');
|
||||
} elseif ($ext === 'pdf') {
|
||||
header('Cache-Control: public, max-age=86400');
|
||||
header('Content-Disposition: ' . ($forceDownload ? 'attachment' : 'inline'));
|
||||
header('Content-Disposition: inline');
|
||||
} elseif (in_array($ext, ['mp4','webm','ogv','mov'], true)) {
|
||||
// Video: no cache-control range requests should work
|
||||
header('Accept-Ranges: bytes');
|
||||
@@ -135,10 +130,9 @@ class MediaController
|
||||
header('Accept-Ranges: bytes');
|
||||
header('Cache-Control: public, max-age=86400');
|
||||
} else {
|
||||
// Unknown / other: force download
|
||||
$safeFilename = preg_replace('/[^A-Za-z0-9._-]/', '_', basename($realFull));
|
||||
header('Content-Disposition: attachment; filename="' . $safeFilename . '"');
|
||||
header('Cache-Control: private, no-store');
|
||||
// Unknown / other: serve inline, no download
|
||||
header('Content-Disposition: inline');
|
||||
header('Cache-Control: public, max-age=86400');
|
||||
}
|
||||
|
||||
// 7. Stream file (with range support for media)
|
||||
|
||||
Reference in New Issue
Block a user