The file in question is /system/interceptors/SES.cfc
In the host app, I have /handlers/admin/person.cfc which is part of a monolith I'm migrating into modules. I also have a module loaded named 'person' that I'm wanting to start moving some of the person handler's code into.
If I try to hit /admin/person/someHandlerMethod with SES configured, it correctly finds the 'admin' package (or folder) which is /handlers/admin and begins crafting the newEvent as "admin.". But when it comes to the next iteration of the for loop it checks to see if thisFolder exists in instance.modules. I think this is where the problem happens. If we know we're already matching within the host application's /handlers folder, it isn't consistent to switch over half way through and begin treating it like the event is targeting a module.
The final routed event ends up being "admin.person:someHandlerMethod" (with a colon) rather than "admin.person.someHandlerMethod" (all dots). If I let execution continue it throws an exception later on as it tries to process it as if there were a module named "admin.person" that had a handler named "someHandlerMethod" in it.
On 4.2, just after this comment
I put the if statement in since it should only be done once. Could probably also be if( x == 1 ).
I then modified this line
to look like this
This worked for me, though I didn't do any other testing to see what else it might break
Pardon this comment in place of an actual pull request. If I get some time I'll submit one.
I was able to find a temporary workaround for the bug by adding an explicit route in the host Routes.cfc:
If you do this, just be sure to add it prior to the default route:
I've discovered this is also an issue if you have the following setup.
The app loads two modules, one named "alpha" and the other named "beta".
In beta, you have a package named "user" and a handler named "alpha.cfc" with a method "delta". The SES URL for delta is /myApp/beta/user/alpha/delta
This produces a 404. It gets as far as getting newevent = "beta:user." and then dies when it incorrectly identifies "alpha" (the next slice off rString) as the "alpha" module (instance.modules.alpha) rather than looking for a handler file in the /user directory named alpha.cfc
If I add this.entryPoint = "/myApp/beta"; in the beta module's ModuleConfig.cfc and look in the coldbox debugger snapshot panel, I see it's got Current Event as "beta:user.alpha:delta", so I think the code is going to jump the tracks over to looking for modules in all cases.
As we migrate from a monolith to modules we're running into cases where the most natural naming follows this exact pattern. We can name the handlers things like "alpha2", but it leads to challenges: "I know it's 'alpha', but do I add a 2 in this case or not?"
I think probably in order for the fix to address this case, it should never look at instance.modules to find things after starting down the path of either a host handler or a loaded module.
I believe you have a point. We will address it