Fix Windows media source paths for Flysystem - #16995
Open
Ibochkarev wants to merge 1 commit into
Open
Conversation
Flysystem object keys always use "/", so DIRECTORY_SEPARATOR broke rename/create/move path joins on Windows. Normalize virtual paths to forward slashes and keep parent directories on rename.
Ibochkarev
force-pushed
the
fix/issue-15438-windows-path-separator
branch
from
August 15, 2026 02:04
a1269a0 to
da88351
Compare
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.
What changed and why
On Windows, Flysystem object keys use
/, while media source code joined and split paths withDIRECTORY_SEPARATOR(\). Nested rename dropped the parent directory and moved the object to the wrong place (often under the site core path).#15440only cleared PHP “passed by reference” notices; path creation stayed broken (confirmed in issue comments).This change treats Flysystem object paths as always
/:sanitizePath/postfixSlash, helpers for root / join / rename, and the same join logic for create, move, list ids, and S3.How to test
php -l core/src/Revolution/Sources/modMediaSource.php→ exit 0php -l core/src/Revolution/Sources/modS3MediaSource.php→ exit 0composer run-script phpunit -- --filter modMediaSourceTest→ OK (4 tests, 15 assertions)Related issue(s)/PR(s)
Resolves #15438
Compatibility notes
Affects local and S3 media sources on all platforms. Behavior on Unix stays the same (
/already matchedDIRECTORY_SEPARATOR). Windows file manager path joins should now match Flysystem keys. Local OS path handling inprepareSrcForThumbstill usesDIRECTORY_SEPARATORfor phpThumb/file_exists checks.Breaking change assessment
No public method signatures changed. Path strings returned from media source APIs may normalize separators to
/more consistently (Flysystem-compatible). Safe for patch consumers that already treated Flysystem paths as/.Test coverage
_build/test/Tests/Model/Sources/modMediaSourceTest.php: sanitize/postfix with\,getRenamedPathparent retention, root detection afterpostfixSlash('')→/,joinFilesystemPathsfor move/create-style joins.Contributors
Thanks @sergant210 for the report, @wax100 for the Windows/OpenServer reproduction, and @Mark-H for confirming
#15440did not fix path creation.AI tool use
Cursor agent assisted implementation, tests, and review loops. Human review still required before merge.