Repository navigation
[6.x] Fix deleting directories with a dot in their name - #16164
Merged
jasonvarga merged 1 commit intoDec 4, 2026
Merged
Conversation
…extension FlysystemAdapter inherited AbstractAdapter::isDirectory(), which treats any path with an extension as a file. Directories with a dot in their name (e.g. form submission ids like 1765432100.1234) were therefore deleted with unlink(), which fails with "Is a directory".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FlysystemAdapterinheritsAbstractAdapter::isDirectory(), which decides whether a path is a directory by checking that it exists and has no extension. A directory with a dot in its name is therefore treated as a file.This shows up with Forms 2 uploads. Temporary uploads are stored in
statamic/form-uploads/{submission id}/{field}/, and submission ids contain a dot (e.g.1765432100.1234). After a submission the temporary files are deleted, leaving the empty folders behind. WhenDeleteTemporaryFileUploadslater runsdeleteEmptySubfolders(),delete()callsisDirectory(), getsfalseand callsunlink()on the directory:The middleware runs before the request is handled, so the Control Panel request that wins the cleanup lottery fails with a 500 (on disks with
throwenabled; otherwise the folders are silently never cleaned up).This PR overrides
isDirectory()inFlysystemAdapterto ask the filesystem viadirectoryExists(), matching whatFilesystemAdapteralready does withFilesystem::isDirectory(). This also stops files without an extension (e.g.LICENSE) being treated as directories.Tests are added to the shared
FilesystemAdapterTests, so they run against both adapters. Both fail forFlysystemAdapterwithout the fix.To reproduce manually: