Fix filename extension stripping bug and clean up dev tooling#28
Closed
f2cmb wants to merge 2 commits intoBeAPI:masterfrom
Closed
Fix filename extension stripping bug and clean up dev tooling#28f2cmb wants to merge 2 commits intoBeAPI:masterfrom
f2cmb wants to merge 2 commits intoBeAPI:masterfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
herewithme
reviewed
Apr 3, 2026
herewithme
reviewed
Apr 3, 2026
Member
|
Merci pour le report de bugs, j'ai repris la prop ici : #29 |
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.

Summary
The main fix:
str_replace($ext, '', $file_name)stripped every occurrence of the extension string from the filename, not just the suffix. Example:css.style.cssbecamestyleinstead ofcss.style. Fixed withpathinfo()+substr().Since I was in there anyway, I cleaned up a few things that were bugging me:
testVersionwas set to5.6-but the plugin requires PHP 8.0+. Updated to8.0-.convert*ToExceptionsattributes from PHPUnit config (deprecated in 9.5, gone in 10).test_convert_at_sign_to_dashestotest_remove_at_sign, since the@is stripped, not converted to a dash.Note
High Risk
Changes core upload filename sanitization and updates the special-character lists; the latter introduces non-standard quote characters that could cause parsing/runtime issues if not intentional. Also updates PHP compatibility/testing configs, which may affect CI outcomes.
Overview
Fixes a filename extension handling bug in
bea_sanitize_file_name()by switching from regex/str_replace()topathinfo()+substr()so only the trailing extension is removed and then re-appended.Updates the set of characters escaped by
bea_sanitize_file_name_chars()and cleans up related comments, but also changes the quoting of these literals (now using typographic quotes), which may alter behavior or even break parsing if unintended.Modernizes dev tooling by bumping
PHPCompatibilityto8.0-inphpcs.xml, removing deprecated PHPUnitconvert*ToExceptionsflags, and renaming a unit test to reflect that@is removed rather than converted.Written by Cursor Bugbot for commit 59b8e05. This will update automatically on new commits. Configure here.