tracker issue : CF-4204293

select a category, or use search below
(searches all categories and all time range)
Title:

expandPath incorrectly expands absolute paths

| View in Tracker

Status/Resolution/Reason: To Fix//Investigate

Reporter/Name(from Bugbase): Ryan P. / ()

Created: 05/07/2019

Components: Functions

Versions: 2016

Failure Type: Conflict With Docs

Found In Build/Fixed In Build: 2016,0,10,314028 /

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Windows 10

Vote Count: 0

Problem Description:
According to the documentation for expandPath, it should be able to take in an absolute path and correctly expand it while no direct example is given for this use case it seems reasonable to expect it to return the same path with maybe the slashes corrected for the current OS. Instead it will take the path and append it to the end of the path to the current coldfusion file.

Steps to Reproduce:
writeOutput(expandPath("C:\path\to\file\file.txt"));

Actual Result:
C:\path\to\cfm\file\C:\path\to\file\file.txt

Expected Result:
C:\path\to\file\file.txt

Any Workarounds:
You can workaround this by only attempting to expand the path if it is a relative path. The path can be determined to be relative by calling getDirectoryFromPath on it and the negating the result of directoryExists on the prior results. !directoryExists(getDirectoryFromPath("\path\to\file\file.txt"))

Attachments:

Comments: