-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Normalize input paths in cloud file stores to match IFileStore semantics #18683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normalize input paths in cloud file stores to match IFileStore semantics #18683
Conversation
|
Thank you for submitting your first pull request, awesome! 🚀 If you haven't already, please take a moment to review our contribution guide. This guide provides helpful information to ensure your contribution aligns with our standards. A core team member will review your pull request. If you like Orchard Core, please star our repo and join our community channels. |
@dotnet-policy-service agree |
|
Congratulations on your first PR merge! 🎉 Thank you for your contribution! We're looking forward to welcoming other contributions of yours in the future. @all-contributors please add @moamen-0 for code. If you like Orchard Core, please star our repo and join our community channels. |
|
@github-actions[bot] I've put up a pull request to add @moamen-0! 🎉 |
This PR fixes inconsistent path handling in cloud-based
IFileStoreimplementations by normalizing input paths before they are used in comparisons and directory operations.Problem
IFileStoredefines forward slash (/) as the path delimiter. However, some cloud file store implementations (Azure Blob and AWS S3) were using the rawpathparameter in string comparisons (e.g.EndsWith(path)), which could lead to incorrect behavior when callers passed Windows-style paths using backslashes (\).For example:
This could result in incorrect directory listings or filtering behavior. The issue is less visible when using
FileSystemStore, as it already normalizes paths internally.Changes
pathat the beginning of directory content methods to ensure consistent behavior with theIFileStorecontract.Specifically:
pathin directory listing methods before performing comparisons.pathin directory content retrieval before filtering.Why this change is correct
IFileStoreexplicitly defines/as the canonical path separator.Combine(...)) already normalize paths, but direct string comparisons were still using unnormalized input.Testing
If maintainers prefer extracting this logic for unit testing or adding provider-specific tests, I’m happy to update the PR accordingly.
Fixes #14328