We had some image regeneration scripts and when we changed over to FarCry 
6.3 recently they stopped working properly.

The change seems to be related to the CDN stuff.

We were calling generateImage() from the Image formtool and passing the 
source and destination arguments as FULL disk paths.

<cffunction name="GenerateImage" access="public" output="false" returntype=
"struct">
 <cfargument name="source" type="string" required="true" hint="The absolute 
path where the image that is being used to generate this new image is 
located." />
 <cfargument name="destination" type="string" required="false" default="" 
hint="The absolute path where the image will be stored." />

Now, when we do this, the CDN transforms the path by prepending the FULL 
disk path to the webroot.  So if we pass in 
/sites/farcry/projects/projectname/www/images/someType/imgTeaser/somefile.jpg 
the CDN stuff turns this into 

/sites/farcry/projects/projectname/www/sites/farcry/projects/projectname/www/images/someType/imgTeaser/somefile.jpg

when checking if the file exists:

<cfif not application.fc.lib.cdn.ioFileExists(location="images",file=
arguments.source)>
 <cfset stResult.bSuccess = False />
 <cfset stResult.message = "File doesn't exist" />
 <cfreturn stResult />
</cfif>

which calls this in the local CDN component:

<cffunction name="ioFileExists" returntype="boolean" access="public" output=
"false" hint="Checks that a specified path exists">
 <cfargument name="config" type="struct" required="true" />
 <cfargument name="file" type="string" required="true" />
 
 <cfreturn fileexists(getFullPath(config=
arguments.config,file=arguments.file)) />
 </cffunction>

leading to this culprit:

<cffunction name="getFullPath" output="false" access="public" returntype=
"string" hint="Returns full internal path. Works for files and directories."
>
 <cfargument name="config" type="struct" required="true" />
 <cfargument name="file" type="string" required="true" />
 
 <cfset var fullpath = "" />
 
 <cfif left(arguments.file,1) eq "/">
 <cfset fullpath = arguments.config.fullpath & arguments.file />
 <cfelse>
 <cfset fullpath = arguments.config.fullpath & "/" & arguments.file />
 </cfif>
 
 <cfreturn fullpath />
 </cffunction>


So, shouldn't getFullPath first check to make sure that the "file" passed 
in isn't ALREADY the full path??

In our case ioFileExists was returning false even though the file does 
exist because it was messing up the path.

I have fixed our issue by only passing in webroot relative paths instead of 
the full disk path but this is a backwards compatibility issue for people 
who are manually calling GenerateImage()

Thoughts?

Sean

-- 
You received this message cos you are subscribed to "farcry-dev" Google group.
To post, email: [email protected]
To unsubscribe, email: [email protected]
For more options: http://groups.google.com/group/farcry-dev
--------------------------------
Follow us on Twitter: http://twitter.com/farcry
--- 
You received this message because you are subscribed to the Google Groups 
"farcry-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to