From d246ab44e208283b8d919955d07dcc5eac910518 Mon Sep 17 00:00:00 2001 From: hajimi Date: Sat, 13 Jun 2026 11:43:39 +0800 Subject: [PATCH] deploy: auto commit repo-root changes 2026-06-13 11:43:39 --- server/app/api/controller/CommunityController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/app/api/controller/CommunityController.php b/server/app/api/controller/CommunityController.php index 124af7c..6fc811c 100644 --- a/server/app/api/controller/CommunityController.php +++ b/server/app/api/controller/CommunityController.php @@ -839,7 +839,10 @@ class CommunityController extends BaseApiController $relativeDir = 'uploads/ai_lottery_posts/' . date('Ymd'); $publicRoot = rtrim(public_path(), DIRECTORY_SEPARATOR . '/'); $targetDir = $publicRoot . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $relativeDir); - if (!is_dir($targetDir) && !mkdir($targetDir, 0755, true) && !is_dir($targetDir)) { + if (!is_dir($targetDir) && !@mkdir($targetDir, 0755, true) && !is_dir($targetDir)) { + return ''; + } + if (!is_writable($targetDir)) { return ''; } @@ -847,7 +850,7 @@ class CommunityController extends BaseApiController $relativeUri = $relativeDir . '/' . $filename; $targetPath = $targetDir . DIRECTORY_SEPARATOR . $filename; - if (!is_file($targetPath) && file_put_contents($targetPath, $body) === false) { + if (!is_file($targetPath) && @file_put_contents($targetPath, $body) === false) { return ''; }