diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-08-16 12:36:16 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-08-16 12:36:16 +0900 |
| commit | b12c2b15f0487d54d359a581e99ced68713914d0 (patch) | |
| tree | 4e594a540f189f7e933766f9c922cc1fcf1424da /crates/shirabe | |
| parent | 45f0ae17ce5528af2af66fd681e88fe4a4a7cd6e (diff) | |
| download | php-shirabe-b12c2b15f0487d54d359a581e99ced68713914d0.tar.gz php-shirabe-b12c2b15f0487d54d359a581e99ced68713914d0.tar.zst php-shirabe-b12c2b15f0487d54d359a581e99ced68713914d0.zip | |
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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe')
| -rw-r--r-- | crates/shirabe/src/config.rs | 9 |
1 files changed, 2 insertions, 7 deletions
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<CaptureKey, String> = IndexMap::new(); if !Preg::is_match3( php_regex!(r"/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i"), |
