From a1ae74837f2bacdfe52d56f8eca8d6ddb9e44c1c Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 12 May 2025 12:25:46 +0900 Subject: [PATCH] Fix incorrect return type when HTTP::download() cannot write to target file or parent directory --- common/framework/HTTP.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/framework/HTTP.php b/common/framework/HTTP.php index 5f38d3cb6..d0d39304d 100644 --- a/common/framework/HTTP.php +++ b/common/framework/HTTP.php @@ -91,7 +91,11 @@ class HTTP $target_dir = dirname($target_filename); if (!Storage::isDirectory($target_dir) && !Storage::createDirectory($target_dir)) { - return false; + return new Helpers\HTTPHelper(new Exception('Cannot create directory: ' . $target_dir)); + } + if (!Storage::isWritable($target_dir) && (!Storage::exists($target_filename) || !Storage::isWritable($target_filename))) + { + return new Helpers\HTTPHelper(new Exception('No permission to write file: ' . $target_filename)); } // Pass to request() with appropriate settings for the filename.