Skip to content

Commit b0d7376

Browse files
committed
[BUG] filesystem: skip symbolic links instead of aborting
`FlySystemAdapter::createForPath()` instantiates the Local/Flysystem adapter with the default link-handling mode, which is `DISALLOW_LINKS` in both `league/flysystem` v1 (`Adapter\Local`) and v3 (`Local\LocalFilesystemAdapter`). When the adapter's `listContents()` encounters any symbolic link during directory traversal it throws — v1: `League\Flysystem\NotSupportedException`, v3: `League\Flysystem\SymbolicLinkEncountered` — aborting the whole render. Concrete consumer impact ------------------------ `phpDocumentor\Guides\Handlers\ParseDirectoryHandler` calls `FlySystemAdapter::listContents()` to find the entrypoint of an input directory. A single symlink anywhere in the input tree kills the run, even for symlinks that point to files the parser would ignore anyway (e.g. `CLAUDE.md -> AGENTS.md` for AI tooling, vendored references, build artefacts). Downstream report in the TYPO3 render-guides wrapper: TYPO3-Documentation/render-guides#1234 Fix --- Pass `SKIP_LINKS` as the link-handling constructor argument to both the v1 and v3 Local adapters. This preserves the current "do not follow links" posture but turns an abort into a silent skip — aligning with how most documentation builders treat filesystem entries they can't or shouldn't parse. - v1: `new Local($path, LOCK_EX, Local::SKIP_LINKS)` (positional, since v1's constructor predates named args; `LOCK_EX` is the library's own default for `$writeFlags`). - v3: `new LocalFilesystemAdapter($path, linkHandling: SKIP_LINKS)` (named arg, skipping the unchanged `$visibility` and `$writeFlags`). Verification ------------ The project has `FlySystemAdapter::createForPath` as its one code path for building filesystem instances from a local path, so this covers every entry point. Downstream reproducer (now green once shipped): ln -s AGENTS.md Documentation/CLAUDE.md docker run --rm -v "$PWD:/project" -w /project \ ghcr.io/typo3-documentation/render-guides:latest \ render --config=Documentation --output=out Documentation Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
1 parent 5979f82 commit b0d7376

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/filesystem/src/FlySystemAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ public static function createForPath(string $path): self
3434
{
3535
if (class_exists(Local::class)) {
3636
/** @phpstan-ignore-next-line */
37-
$filesystem = new FlysystemV1(new LeagueFilesystem(new Local($path)));
37+
$filesystem = new FlysystemV1(new LeagueFilesystem(new Local($path, LOCK_EX, Local::SKIP_LINKS)));
3838
} else {
3939
$filesystem = new FlysystemV3(
4040
new LeagueFilesystem(
41-
new LocalFilesystemAdapter($path),
41+
new LocalFilesystemAdapter($path, linkHandling: LocalFilesystemAdapter::SKIP_LINKS),
4242
),
4343
);
4444
}

0 commit comments

Comments
 (0)