[TYPO3-Solr] indexing problem with foldernames withblankincluded

Jigal van Hemert jigal at xs4all.nl
Wed Oct 12 07:04:21 CEST 2011


Hi,

On 11-10-2011 22:14, Claus Fassing wrote:
> The field fileRelativePath from indexed file contain s.th. like
> fileadmin/foo bar/myIndexedDoc.pdf
>
> The typolink function cObj is calling with "myIndexedDoc.pdf"
> as param $linktxt.
> The attribute $link_param of this function is getting the whole path
> "fileadmin/foo bar/myIndexedDoc.pdf" which get cut off in static
> function unQuoteFilenames ($link_paramA).
> Result in "fileadmin/foo"

typolink uses spaces to separate the various parts of the link:

destination target class title

If any part has spaces it can be quoted. However, any quotes in a part 
must then be escaped with backslashes.

In PHP you could use the function escapeshellarg() for it, but this has 
some issues with UTF-8 filenames, so it needs a bit of extra work:


if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
   $currentLocale = setlocale(LC_CTYPE, 0);
   setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']);
}
$escapedInputName = escapeshellarg($inputName);
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']) {
   setlocale(LC_CTYPE, $currentLocale);
}

> Can a piece additional TS avoid this behavior ?

Maybe a preUserFunc can call this piece of PHP? It would be useful if 
solr could provide such a function.

It's not a bug in the core. It's just unfortunate that there is no 
standard way to quote a part like the filename. This could be added to 
Typoscript, but that would be for TYPO3 4.7 and above.

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert.


More information about the TYPO3-project-solr mailing list