tracker issue : CF-4205827

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

getCanonicalPath appends colon when path ends with trailing slash

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NeedMoreInfo

Reporter/Name(from Bugbase): Tobias R. / ()

Created: 11/08/2019

Components: Language, Functions

Versions: 2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2018.0.02.313961 /

Priority/Frequency: Normal / All users will encounter

Locale/System: English / Mac All

Vote Count: 0

Problem Description:
If you pass a path with a trailing slash into getCanonicalPath, it appends a colon at the end of the string.

Steps to Reproduce:

<cfset path = "/Library/WebServer/Documents/sample">
<cfoutput>Original: #path#<br /></cfoutput>
<cfset testPath = getCanonicalPath(path) />
<cfoutput>Canonical: #testPath#<br /></cfoutput>

<cfset path = "/Library/WebServer/Documents/sample/">
<cfoutput>Original with Slash: #path#<br /></cfoutput>
<cfset testPath = getCanonicalPath(path) />
<cfoutput>Canonical with Slash: #testPath#<br /></cfoutput>

Actual Result:
Original: /Library/WebServer/Documents/sample
Canonical: /Users/tobyreiter/htdocs/sample
Original with Slash: /Library/WebServer/Documents/sample/
Canonical with Slash: /Users/tobyreiter/htdocs/sample:
Expected Result:
Original: /Library/WebServer/Documents/sample
Canonical: /Users/tobyreiter/htdocs/sample
Original with Slash: /Library/WebServer/Documents/sample/
Canonical with Slash: /Users/tobyreiter/htdocs/sample/

Any Workarounds:



Tobias, This is not reproducible on update 6. I can observe it on update 4 though. Can you pls. check it on the latest CF update.
Comment by Piyush K.
31886 | November 27, 2019 11:38:09 AM GMT
The colon is missing in the most recent update. However, code that I'm using (a third party framework that hasn't been updated recently), uses getCanonicalPath and expects the path to have a trailing slash -- the most recent version of getCanonicalPath omits the trailing slash, but this may be intentional.
Comment by Tobias R.
31926 | December 04, 2019 07:42:55 PM GMT
closing this since the issue is no longer there. Not sure how a third party f/w is tied to a CF version, unless it's more of a service. doesn't make sense for the method to return a trailing slash,
Comment by Piyush K.
33298 | March 16, 2020 05:12:38 AM GMT