Bug 165758 - Possible issue in Xapian search result template
Summary: Possible issue in Xapian search result template
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Olivier Hallot
URL:
Whiteboard: target:25.8.0
Keywords:
Depends on:
Blocks: New-Help
  Show dependency treegraph
 
Reported: 2025-03-15 15:53 UTC by Andras Timar
Modified: 2025-04-17 12:55 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Timar 2025-03-15 15:53:36 UTC
I found this during random testing:

https://help.libreoffice.org/25.2/bg/search?P=Diagram
Exception: too many arguments to $if
Comment 1 Andras Timar 2025-03-15 17:18:43 UTC
This is the problematic $if:
$if{$query,Няма документи, отговарящи на заявката ви.,
<hr>Претърсват се $nice{$dbsize} документа
}
In translation there is a comma, that is not escaped. 
Instead of literal ',', there could be '$.' or '$chr{44}'. It's a real pain to replace strings in XSLT 1.0.
Comment 2 Olivier Hallot 2025-03-17 20:26:55 UTC
Isn't the case of asking the translator to rephrase the string without a comma?

Automatic replacement with a rule in XSLT may result in poor translation.
Comment 3 Andras Timar 2025-03-18 06:54:52 UTC
Replacing , to $. in xap_tpl will not change the translation. 
The problem is that you use unescaped input (a translation) that can be interpreted as code.
Comment 4 Commit Notification 2025-04-02 22:29:07 UTC
Olivier Hallot committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/a8e9369e739ce9119af7a662e46b662804f7c1d9

tdf#165758 Escape CGI comma for xapian template