Scott, you are genius!

Jacopo

On Apr 3, 2012, at 12:56 PM, Scott Gray wrote:

> +1, having a template in runtime seems a little strange to me, everything 
> functional should really exist in a component.
> 
> But as an aside, location resolution in performed with FlexibleLocation so 
> the following path should also work:
> ofbizhome://runtime/svninfo.ftl
> 
> Regards
> Scott
> 
> On 3/04/2012, at 10:44 PM, Jacopo Cappellato wrote:
> 
>> But the more I think about it the more I think that it is wrong to include 
>> templates in this way:
>> 
>> <#include "../../../runtime/svninfo.ftl" />
>> 
>> here a template from a component (a theme) is trying to load a template that 
>> is not in the component or in any other component.
>> But it used to work because in previous releases the above was converted in:
>> 
>> component://tomahawk/includes/../../../runtime/svninfo.ftl
>> 
>> and this was a tweak to let OFBiz believe that the file was part of the 
>> tomahawk component... 
>> 
>> I have checked the code and directives like:
>> 
>> <#include "../
>> 
>> are only the ones in the themes for including the svninfo.ftl file.
>> 
>> Do you agree with removing these directives until we find a better way to do 
>> this (the ant task could copy the svninfo.ftl file somewhere in the theme... 
>> or we could find a better mechanism)?
>> 
>> Jacopo
>> 
>> 
>> On Apr 3, 2012, at 12:29 PM, Jacopo Cappellato wrote:
>> 
>>> A short update on this issue:
>>> 
>>> the problem is happening with freemarker-.2.3.19 while earlier versions are 
>>> not affected (e.g. freemarker-2.3.18).
>>> In earlier versions the following include directive:
>>> 
>>> <#include "../../../runtime/svninfo.ftl" />
>>> 
>>> in a file in themes/tomahawk/includes/
>>> 
>>> was converted in location like:
>>> 
>>> component://tomahawk/includes/../../../runtime/svninfo.ftl
>>> 
>>> With freemarker-.2.3.19 the location is converted to:
>>> 
>>> component:/runtime/svninfo.ftl
>>> 
>>> Please notice the single "/" after the ":".
>>> 
>>> The reason for this is explained here 
>>> http://freemarker.sourceforge.net/docs/pgui_config_templateloading.html#autoid_43
>>>  
>>> 
>>> Quote:
>>> 
>>> "Note that FreeMarker always normalizes the paths before passing them to 
>>> the template loader, so the paths do not contain /../ and such, and are 
>>> relative to the imaginary template root directory."
>>> 
>>> There were also security reasons for the change as explained here:
>>> 
>>> https://sourceforge.net/projects/freemarker/files/freemarker/2.3.19/
>>> 
>>> Jacopo
>>> 
>>> 
>>> On Apr 3, 2012, at 9:49 AM, Jacopo Cappellato wrote:
>>> 
>>>> I have committed a workaround for the issue in rev. 1308734
>>>> 
>>>> I am still investigating the root cause. Please let me know if you see 
>>>> other wrong things: this is a rather big jump from Freemarker 2.3.10 to 
>>>> 2.3.19!
>>>> 
>>>> Thanks,
>>>> 
>>>> Jacopo
>>>> 
>>>> On Apr 2, 2012, at 8:22 PM, Erwan de FERRIERES wrote:
>>>> 
>>>>> Le 02/04/2012 19:53, Jacopo Cappellato a écrit :
>>>>>> I see it now, it doesn't like the following directive:
>>>>>> 
>>>>>> <#include "../../../runtime/svninfo.ftl" />
>>>>>> 
>>>>>> I will dig into it more.
>>>>>> 
>>>>> 
>>>>> Thanks !
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Erwan de FERRIERES
>>>>> www.nereide.biz
>>>> 
>>> 
>> 
> 

Reply via email to