Account for leading slashes in mapDirectory()


Within ModuleConfig.cfc, ACF throws an error when binder.mapDirectory() is passed a packagePath argument with a leading slash.

This causes problems, because the moduleMapping variable includes a leading slash.

This issue was raised on Slack when a user tried to use my sendgridcfc module.

In ColdBox 5.2 on ACF, the following line causes an error:

The .modules.sendgridcfc.helpers.sender name is not a valid component or interface name.

When the opening slash of the moduleMapping is replaced, the issue is resolved:
packagePath = "#moduleMapping.REreplace( '^/', '' )#/helpers",

I believe it's the line here, that replaces the all slashes with dots, even if it's a leading slash:


Matthew Clemente
October 30, 2018, 10:29 AM

I think I can resolve this, within Binder.cfc.

When the path is normalized to dot notation, I can remove a leading slash, if present. I think it's safe to assume that a leading slash would never belong, at that point (correct me if I'm wrong).

If this seems like an acceptable approach, I'll put in a PR and you can look at it further.

Luis Majano
November 1, 2018, 8:42 PM

Yes, please do, thanks!

Matthew Clemente
November 2, 2018, 10:23 AM


Luis Majano


Matthew Clemente



Fix versions

Affects versions