tracker issue : CF-3125367

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

File include via CFSCRIPT "include" or CFINCLUDE generates an error if path includes extra "/" marks.

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/Duplicate

Reporter/Name(from Bugbase): Wes Byrd / Wes Byrd (Wes Byrd)

Created: 02/28/2012

Components: Language

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Public Beta /

Priority/Frequency: Major / Most users will encounter

Locale/System: English / Win All

Vote Count: 0

Duplicate ID:	CF-3129772

Problem Description:

When including a file via CFINCLUDE or via "include" in CFSCRIPT, an error "Could not find the included template" is generated if the path includes an extra "/" mark.  This does not happen in previous version of CF.  This may cause errors when customers upgrade from CF9 (or earlier) to CF10.

Steps to Reproduce:

<cfinclude template="/path/to//file.cfm" />
<cfscript>include "/path/to//file.cfm"; </cfscript>

Where "/path/to/file.cfm" does not cause an error message.

Actual Result:

An error message "Could not find the included template".  This kind of path is often created when a developer programs a dynamic path... such as...

<cfinclude template="#application.incFilePath#/#url.incFile#" />  ... or something similar.

In this case, if the Application variable ends in "/" or if the URL variable begins with "/", CF10 will cause and error where CF9 and previous would not.

Expected Result:

The developer will expect CF10 to treat CFINCLUDE the same way that was in CF9 and before.

Any Workarounds:

The only workaround is to fix your code or to fix your data to not have the extra "/" marks in the path.  Or, we could write a function to clean up the paths before inserting into the CFINCLUDE tag.  However, this would cause existing applications to be "fixed" in order to run CF10.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3125367

External Customer Info:
External Company:  
External Customer Name: Wes Byrd
External Customer Email:  
External Test Config: My Hardware and Environment details:



Using CF10 Public Beta (ColdFusion 10,281485) on Windows 7/IIS7 on a Dell Precision laptop.



I suspect this will occur on any Windows OS... not sure about Linux, but it most likely will do the same.

Attachments:

Comments:

I'm not able to reproduce this. Can you ensure that the template is present in the specified directory. Here are cases I tried: include "/cfsuite//testinclude.cfm"; include "/cfsuite///testinclude.cfm"; include "/cfsuite////testinclude.cfm"; If you are able to reproduce it at your end, then please send us the files. (Comment added from ex-user id:sagarg)
Comment by Adobe D.
20523 | February 29, 2012 01:01:48 AM GMT
Each of my tests are about three levels deep. Here is an example: <cfinclude template="/themes/basic//include.cfm"> generates error. <cfinclude template="/themes/basic/include.cfm"> does not generate error Error: Could not find the included template /themes/basic//include.cfm. Note: If you wish to use an absolute template path (for example, template="/mypath/index.cfm") with CFINCLUDE, you must create a mapping for the path using the ColdFusion Administrator. Or, you can use per-application settings to specify mappings specific to this application by specifying a mappings struct to THIS.mappings in Application.cfc. Using relative paths (for example, template="index.cfm" or template="../index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with CFINCLUDE whenever possible.
Comment by External U.
20524 | March 01, 2012 02:37:05 PM GMT
I'm still not able to reproduce this. Can you place the themes directory under the webroot and then try. Please send the directory containing the test files. (Comment added from ex-user id:sagarg)
Comment by Adobe D.
20525 | March 01, 2012 11:22:51 PM GMT