Skip to content

Throw exception when stating a non-existent directory#32

Open
eltouf wants to merge 1 commit intom2mtech:mainfrom
eltouf:fix/streamStatCommand
Open

Throw exception when stating a non-existent directory#32
eltouf wants to merge 1 commit intom2mtech:mainfrom
eltouf:fix/streamStatCommand

Conversation

@eltouf
Copy link
Copy Markdown

@eltouf eltouf commented Mar 25, 2026

Description

This PR fixes an issue where StreamStatCommand::run returns a stat array instead of throwing an exception when targeting a directory that does not exist.

Context & Problem

  • Library Version: v1.4.1
  • Related Dependencies: league/flysystem-aws-s3-v3 (3.32.0)

Since commit b5c83a6, the generic PHP function is_dir appears to return true even when a folder does not exist in the source wrapper.

Technical Analysis

Before the mentioned commit, the following line ensured an exception was thrown if the file/directory was missing:

$lastModified = $current->filesystem->lastModified($current->file);

However, with the changes introduced, this check is bypassed or no longer triggers the exception for non-existent directories. Consequently, StreamStatCommand returns a success array for paths that are technically invalid/missing.

Expected Behavior

StreamStatCommand::run should throw a League\Flysystem\UnableToRetrieveMetadata (or similar) exception when attempting to retrieve stats for a non-existent directory, restoring the behavior prior to v1.4.x changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant