I found something that I am not sure if it is a bug or a "feature" whilst developing some functionality in our CMS. Essentially imagine you have the following directory layout:
- index.cfm
- level1/
- level2/
- index.cfm
- level2/
<cfset mypath1 = "/level1/level2">
<cfdump var="#expandPath(mypath1)#">
Which (in my case) returns: /Library/WebServer/Documents/scratch/level1/level2
BUT if you add the forward slash to the path:
<cfset mypath2 = "/level1/level2/">
<cfdump var="#expandPath(mypath2)#">
You get: /Library/WebServer/Documents/scratch/level1/level2/index.cfm/ ?!
Where did "index.cfm/" come from? I can understand how that might be useful in 0.1% of cases but not when you are simply trying to find the path to the folder. If you remove the index.cfm from the folder it all works fine.








7 responses
1 Ben Nadel // Jan 23, 2009 at 5:59 PM
2 tony petruzzi // Jan 23, 2009 at 6:53 PM
this bug was not reproducible.
it could also be a mapping issue.
3 Mark Mandel // Jan 23, 2009 at 9:49 PM
I've totally seen this before.
I'm willing to guess you're on Apache as a webserver?
If I remember correct, expandPath() will somehow look to your default webserver page mappings, and attempt to append their values to your expandPath(). It's weird, and bizarre, and I don't know WHY, but it's definitely reproducible.
4 Gary Funk // Jan 24, 2009 at 5:37 PM
D:\www\rk7\level1\level2\
Under Apache:
D:\www\rk7\level1\level2\index.cfm\
5 Pierre Paridans // Jan 26, 2009 at 9:39 AM
6 Dennis Belmont // Mar 2, 2010 at 3:52 PM
D:\inetpub\ensco
I'm getting this:
C:\ColdFusion8\wwwroot\
Has anyone seen this before? Any ideas?
7 david // Aug 17, 2010 at 9:45 PM
Add a "/" mapping in CFADmin to the web root of your site
Made my Apache expand path errors go away