0 ? library_fetch_document($documentId, $publicOnly) : null; if (!$document || empty($document['file_path'])) { http_response_code(404); die('Document not found or no file attached.'); } $fileUrl = library_file_url((string) $document['file_path']); ?>