diff --git a/web/app/controllers/contest_resources.php b/web/app/controllers/contest_resources.php index 710fbf8..66fbb81 100644 --- a/web/app/controllers/contest_resources.php +++ b/web/app/controllers/contest_resources.php @@ -19,12 +19,15 @@ $sub_path = UOJRequest::get('sub_path', 'is_string', ''); if ($sub_path) { $filepath = realpath(UOJContest::cur()->getResourcesPath(rawurldecode($sub_path))); $realbasepath = realpath(UOJContest::cur()->getResourcesPath()); + $filename = basename($filepath); if (!strStartWith($filepath, $realbasepath)) { UOJResponse::page406(); } - UOJResponse::xsendfile($filepath); + UOJResponse::xsendfile($filepath, [ + 'attachment' => $filename, + ]); } $global_readonly = !UOJContest::cur()->userCanManage(Auth::user());