Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3025-rootpath-anchor.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The application template's `this.wheels.rootPath` now anchors to `GetCurrentTemplatePath()` (the `public/` front-controller directory) instead of `GetBaseTemplatePath()` (whatever file was originally requested). When a request bootstrapped under a subfolder — e.g. the test runner — the old base-template anchor produced an unstable path, and because `rootPath` seeds `this.name` via `Hash(rootPath)`, that silently split one app across two application scopes (the "reload=true fixes it" symptom). The value is identical for a normal front-controller request, so existing apps are unaffected (#3025, refs #2887)
11 changes: 10 additions & 1 deletion cli/lucli/templates/app/public/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@ component output="false" {

// Put variables we just need internally inside a wheels struct.
this.wheels = {};
this.wheels.rootPath = GetDirectoryFromPath(GetBaseTemplatePath());
// Anchor to THIS file's directory (the public front-controller dir), not the
// base template's. GetBaseTemplatePath() returns whatever file was originally
// requested, so when a request bootstraps under a subfolder (e.g. the test
// runner) rootPath would mis-anchor — and since it seeds `this.name` via
// Hash(rootPath) below, an unstable value silently splits one app across two
// application scopes (the "reload=true fixes it" symptom in issue #3025/#2887).
// GetCurrentTemplatePath() is always this Application.cfc's path, so rootPath
// stays stable regardless of the requested base template — and is identical to
// the old value for a normal front-controller request.
this.wheels.rootPath = GetDirectoryFromPath(GetCurrentTemplatePath());

this.name = createUUID();

Expand Down
6 changes: 5 additions & 1 deletion examples/starter-app/public/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ component output="false" {

// Put variables we just need internally inside a wheels struct.
this.wheels = {};
this.wheels.rootPath = GetDirectoryFromPath(GetBaseTemplatePath());
// Anchor to this file's directory, not the requested base template's, so
// rootPath stays stable when a request bootstraps under a subfolder (e.g.
// the test runner) — Hash(rootPath) below seeds this.name, and an unstable
// value splits one app across two application scopes (issue #3025/#2887).
this.wheels.rootPath = GetDirectoryFromPath(GetCurrentTemplatePath());

this.name = createUUID();
// Give this application a unique name by taking the path to the root and hashing it.
Expand Down
6 changes: 5 additions & 1 deletion examples/tweet/public/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ component output="false" {

// Put variables we just need internally inside a wheels struct.
this.wheels = {};
this.wheels.rootPath = GetDirectoryFromPath(GetBaseTemplatePath());
// Anchor to this file's directory, not the requested base template's, so
// rootPath stays stable when a request bootstraps under a subfolder (e.g.
// the test runner) — Hash(rootPath) below seeds this.name, and an unstable
// value splits one app across two application scopes (issue #3025/#2887).
this.wheels.rootPath = GetDirectoryFromPath(GetCurrentTemplatePath());

this.name = createUUID();
// Give this application a unique name by taking the path to the root and hashing it.
Expand Down
6 changes: 5 additions & 1 deletion public/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ component output="false" {

// Put variables we just need internally inside a wheels struct.
this.wheels = {};
this.wheels.rootPath = GetDirectoryFromPath(GetBaseTemplatePath());
// Anchor to this file's directory, not the requested base template's, so
// rootPath stays stable when a request bootstraps under a subfolder (e.g.
// the test runner) — Hash(rootPath) below seeds this.name, and an unstable
// value splits one app across two application scopes (issue #3025/#2887).
this.wheels.rootPath = GetDirectoryFromPath(GetCurrentTemplatePath());

this.name = createUUID();
// Give this application a unique name by taking the path to the root and hashing it.
Expand Down
5 changes: 4 additions & 1 deletion vendor/wheels/rocketunit_tests/Application.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ component {

// Put variables we just need internally inside a wheels struct.
this.wheels = {};
this.wheels.rootPath = GetDirectoryFromPath(GetBaseTemplatePath());
// Anchor to this file's directory (matches this.webrootDir below), not the
// requested base template's, so rootPath stays stable under subfolder
// bootstrap (issue #3025/#2887).
this.wheels.rootPath = GetDirectoryFromPath(GetCurrentTemplatePath());

this.webrootDir = getDirectoryFromPath( getCurrentTemplatePath() );
this.appDir = getCanonicalPath("_assets");
Expand Down
Loading