Creating a / mapping causes incorrect path expansions, use lucee mappings first

Description

When there is a CF mapping called "/' which points to a drive root, other mappings do not work if they match the names of real folders in the drive root pointed to by the "/" mapping.

mappings = getApplicationSettings().mappings; // BROKEN BEHAVIOR ONLY EXISTS IF "/" MAPPING IS PRESENT mappings[ '/' ] = 'D:/'; // This folder actually exists mappings[ '/commandboxInstall' ] = 'D:\artifacts'; application action="update" mappings="#mappings#"; writeDump( getApplicationSettings().mappings ); // This outputs correctly as "D:\" echo( "expandPath( '/' )" ); writeDump( expandPath( '/' ) ); // Expanding just the mapping correctly outputs "D:\artifacts\" echo( "expandPath( '/commandboxInstall/' )" ); writeDump( expandPath( '/commandboxInstall/' ) ); // Adding non-existent folder still correctly oututs "D:\artifacts\sdfsdf" echo( "expandPath( '/commandboxInstall/sdfsdf' )" ); writeDump( expandPath( '/commandboxInstall/sdfsdf' ) ); // Incorrectly outputs "D:\commandboxInstall\bar" which ignores the mapping // Note this only breaks if there actually is a real folder called "D:\commandboxInstall\bar"!! echo( "expandPath( '/commandboxInstall/bar' )" ); writeDump( expandPath( '/commandboxInstall/bar' ) );

Update:

The resolution of this ticket was to add a new system property called lucee.mapping.first that you can set to true that should favor a mapping over a physical directory.

Attachments

1

Activity

Zac Spitzer 
12 June 2023 at 15:22

Michael Offner 
9 June 2023 at 14:39

i have updated the test case, works as expected in my opinion unless i missing something

https://github.com/lucee/Lucee/blob/c7f5b84297d705d2e5aa45dfe3186759f234b73c/test/tickets/LDEV1718.cfc

Zac Spitzer 
9 June 2023 at 13:01

hmmm this test with the old behavior isn’t working? not sure If I am testing the right thing

an expandpath("/home") should resolve to /home when lucee.mapping.first is false?

https://github.com/lucee/Lucee/actions/runs/5222033388/jobs/9427028355#step:20:1560

[INFO] [java] [script] test.tickets.LDEV1718 [INFO] [java] [script] home [INFO] [java] [script] /home/runner/work/Lucee/Lucee/temp/archive/base/lucee-server/context/temp/ldev1718test-73ph2-ANThCLruUIAuAhVA/_OMnXpHvTnu7MUAslDXuFA

Zac Spitzer 
9 June 2023 at 12:17

added a test which creates a mapping with the name name as the current top level folder

https://github.com/lucee/Lucee/pull/2122

Fixed

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Fix versions

Priority

Created 8 March 2018 at 07:00
Updated 26 March 2025 at 17:35
Resolved 6 April 2018 at 17:31