aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-20 03:24:57 +0900
committernsfisis <nsfisis@gmail.com>2026-07-20 03:24:57 +0900
commit96a8ff0513ae7b012b3e4ba8e43a3eca71847458 (patch)
treef0512378e35aed815051dd2a47839c88a63a7e9c /crates/shirabe/src
parent3f4efd805d0a530e3f515720131c6fbce2c3d31c (diff)
downloadphp-shirabe-96a8ff0513ae7b012b3e4ba8e43a3eca71847458.tar.gz
php-shirabe-96a8ff0513ae7b012b3e4ba8e43a3eca71847458.tar.zst
php-shirabe-96a8ff0513ae7b012b3e4ba8e43a3eca71847458.zip
fix(remote-filesystem): read scheme-less local paths in get_remote_contents
PHP's getRemoteContents calls file_get_contents unconditionally: the same stream wrapper reads file:// URLs, plain local paths and network schemes. The Rust port only handled the explicit "file" scheme, so a scheme-less local packages.json repository failed with "file could not be downloaded". Extend the local branch to empty schemes; the http(s) stub is unchanged. This clears the first blocker of the create-project functional test; its ignore reason now documents the remaining ones (live network and Glob::to_regex emitting PCRE lookaheads the regex crate cannot compile), which need a user decision. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src')
-rw-r--r--crates/shirabe/src/util/remote_filesystem.rs26
1 files changed, 15 insertions, 11 deletions
diff --git a/crates/shirabe/src/util/remote_filesystem.rs b/crates/shirabe/src/util/remote_filesystem.rs
index 9eaf8229..08e8581f 100644
--- a/crates/shirabe/src/util/remote_filesystem.rs
+++ b/crates/shirabe/src/util/remote_filesystem.rs
@@ -722,17 +722,21 @@ impl RemoteFilesystem {
}
let mut caught_e: Option<anyhow::Error> = None;
- let outer: Result<Option<String>, anyhow::Error> = if self.scheme == "file" {
- Ok(match max_file_size {
- Some(max) => file_get_contents5(file_url, false, PhpMixed::Null, 0, Some(max)),
- None => file_get_contents(file_url),
- })
- } else {
- // TODO(phase-c): wrap PHP's `file_get_contents` with stream context and error capture
- // for http(s) and other network schemes; depends on the unmodeled PHP stream-context
- // layer.
- Ok(None)
- };
+ // PHP has no scheme branch here: `file_get_contents` reads `file://` URLs and plain
+ // (scheme-less) local paths through the same stream wrapper it uses for the network
+ // schemes. Only the local subset is modeled so far.
+ let outer: Result<Option<String>, anyhow::Error> =
+ if self.scheme == "file" || self.scheme.is_empty() {
+ Ok(match max_file_size {
+ Some(max) => file_get_contents5(file_url, false, PhpMixed::Null, 0, Some(max)),
+ None => file_get_contents(file_url),
+ })
+ } else {
+ // TODO(phase-c): wrap PHP's `file_get_contents` with stream context and error capture
+ // for http(s) and other network schemes; depends on the unmodeled PHP stream-context
+ // layer.
+ Ok(None)
+ };
match outer {
Ok(v) => result = v,
Err(e) => caught_e = Some(e),