Skip to main content
Known Participant
October 15, 2012
Question

CF10 expandPath() not reliable?

  • October 15, 2012
  • 1 reply
  • 2313 views

Hi all,

after our upgrade to CF10 (problems described under Server Administration) we are now facing another issue.

The result of expandPath() seems to be unreliable.

Assume this Code:

<cfif fileExists(expandpath("#application["photoPath"]#/thumbs/#photos.filename#"))>

     <cfset spreadsheetAddImage(xls,expandpath("#application["photoPath"]#/thumbs/#photos.filename#"),"#get.currentrow + 1#,7,#get.currentrow + 1#,8")>

</cfif>

I'm now sometimes getting errors, that spreadsheetAddImage could not find the file.

This should not be the case, since this function is packet into an cfif where the existence of that file is checked.

Secondly, the file he is searching is located at /opt/coldfusion10/cfusion/wwwroot/photos/thumbs/filename.jpg instead of /srv/www/sitename/photos/thumbs/filename.jpg

Anyone ran into that?

Best Regards

Joerg

This topic has been closed for replies.

1 reply

Inspiring
October 15, 2012

Do me a favour... output each separate part of the path you're expanding, eg:

<cfoutput>

<cfset path = application["photoPath"]>

#path# => #expandPath(application["photoPath"])#<br />

<cfset path &= "/thumbs">

#path# => #expandPath(application["photoPath"])#<br />

<cfset path &= "/#photos.filename#">

#path# => #expandPath(application["photoPath"])#<br />

</cfoutput>

Just to see if there are any unexpected results.

Given you're on *nix, are you sure there is no case-sensitivity issues going on here?

I'd also recommend resolving the path just once, and putting it in a variable:

<cfset path = expandPath("#application["photoPath"]#/thumbs/#photos.filename#")>

Then using the variable for the existence-check and spreadsheet operations.  In case there's something going on with application["photoPath"] between operations. At the very least, it removes a call to expandPath().

--

Adam

Known Participant
October 16, 2012

Hi Adam,

I should have mentioned, that this application is running for several years now.

It started on CF8 and migrated perfectly to CF9.

Now with CF10 I begin to see those errors.

I see that problem in another application too, which is more of a file-portal. Also running for about 2 years without any problem.

Many users are now complaining about permission-erros, produced by wrong expandPath() results...

Regards

Joerg

Adobe Employee
October 16, 2012

Joerg,

We had fixed the expandPath issue in the update 1. Have you applied the update 1?

Rupesh