Account for leading slashes in mapDirectory()

Description

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: https://github.com/mjclemente/sendgrid.cfc/blob/f1320e378c099eb0f63904677e688f59cad50a7c/ModuleConfig.cfc#L30

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: https://github.com/ColdBox/coldbox-platform/blob/0a3b2ee05d7f8cdd28f549568111b3af9d3ada97/system/ioc/config/Binder.cfc#L298

Status

Assignee

Luis Majano

Reporter

Matthew Clemente

Labels

Components

Fix versions

Affects versions

5.2.0

Priority

Minor