always the same bug with your choice:
http://127.0.0.1/?recursivewith in the template
[file=folder=link]
<tr><td>
{.if|{.get|can delete.}{.and|{.get|can access.}|{.get|can archive item.}.}| <input type='checkbox' name='selection' value="%item-url%"> .}
{.if|{.get|is new.}|<span class='flag'> NEW </span>.}
{.if not|{.get|can access.}|<img src='/~img_lock'>.}
<a href="%item-url%"><img src="%item-icon%"> %item-name%</a>
<p> folder= %folder%
<p> item-folder= %item-folder%
<p> item-relative= %item-relative-folder%
<p> item-name= %item-name%
<p> item-url = %item-url%
<p> item-full-url= %item-full-url%
<p> item-resource = %item-resource%
---------------------------
and compare the item-folder line with the relative line : first chars are deleted
using folder.getFolder() is the best way
replace your line
ofsRelItemUrl:=length(optUTF8(diffTpl, folder.pathTill()))+3;by this one only
ofsRelItemUrl:=length(optUTF8(diffTpl, folder.getFolder()))+1;the time to evaluate ofsRelItemUrl is the same in each case