From b12c2b15f0487d54d359a581e99ced68713914d0 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Aug 2026 12:36:16 +0900 Subject: fix(config): stringify cache-files-maxsize like PHP's (string) cast Config::get() resolves cache-files-maxsize by matching the stored value against a size regex. The port read that value with as_string(), which yields None for anything that is not a string, where PHP casts with (string). create-project feeds Config::all() back through Config::merge(), so the second read finds the byte count the first read produced rather than the original "300MiB". as_string() then yields an empty string, the regex fails, and the resulting RuntimeException is swallowed by Config::get(), which maps Err to null. FileDownloader turns that null into a zero max size via .as_int().unwrap_or(0), and Cache::gc() deletes every file in the download cache because the total always exceeds zero. Apply the same cast on the path branch, the other site where Config.php writes (string). Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/config.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'crates') diff --git a/crates/shirabe/src/config.rs b/crates/shirabe/src/config.rs index 5d990c55..04599aa4 100644 --- a/crates/shirabe/src/config.rs +++ b/crates/shirabe/src/config.rs @@ -590,7 +590,7 @@ impl Config { val }; let processed = self.process(raw_val, flags)?; - let mut val_str = rtrim(processed.as_string().unwrap_or(""), Some("/\\")); + let mut val_str = rtrim(&php_to_string(&processed), Some("/\\")); val_str = Platform::expand_path(&val_str); if substr(key, -4, None) != "-dir" { @@ -646,12 +646,7 @@ impl Config { // numbers with kb/mb/gb support, without env var support "cache-files-maxsize" => { - let raw = self - .config - .get(key) - .and_then(|v| v.as_string()) - .unwrap_or("") - .to_string(); + let raw = self.config.get(key).map(php_to_string).unwrap_or_default(); let mut matches: IndexMap = IndexMap::new(); if !Preg::is_match3( php_regex!(r"/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i"), -- cgit v1.3.1-4-g156e