Skip to content

fix: normalize app placeholder variants in app_path() - #2166

Open
raphyabak wants to merge 1 commit into
nWidart:masterfrom
raphyabak:fix/app-path-trailing-slash
Open

fix: normalize app placeholder variants in app_path()#2166
raphyabak wants to merge 1 commit into
nWidart:masterfrom
raphyabak:fix/app-path-trailing-slash

Conversation

@raphyabak

Copy link
Copy Markdown

Summary

app_path() only stripped a leading app/ or the configured custom app folder when the input had an exact, case-sensitive match including a trailing slash. This left app_path('app'), app_path('App/'), and app_path('App\\') unstripped, producing e.g. src/app instead of src when modules.paths.app_folder is customized — as reported in #2152.

  • Normalizes backslashes to forward slashes so App\Foo and App/Foo are handled alike.
  • Compares the leading path segment case-insensitively against both app and the configured custom app folder, so app/, app, App/, and App\ all collapse to the same base path (previously only the exact app/ form worked).

Fixes #2152

Test plan

  • Added a test covering the exact matrix from the issue with app_folder set to src.
  • Verified it fails without the fix (src/app instead of src) and passes with it.
  • Full suite passes, no regressions.
  • composer pcf run against the changed files.

app_path() only stripped a leading "app/" or the configured custom
app folder when the input had an exact, case-sensitive match including
a trailing slash. This left app_path('app'), app_path('App/') and
app_path('App\\') unstripped, producing e.g. 'src/app' instead of
'src' when modules.paths.app_folder is customized.

Normalize backslashes to forward slashes and compare the leading path
segment case-insensitively so all of app/, app, App/, and App\ collapse
to the same base path, matching the default 'app/' case that already
worked.

Fixes nWidart#2152
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

$this->app_path() works with "app/" but not "app"

1 participant