File renaming with IF condition adds unwanted leading space

When using Zotero 7 file renaming with an IF condition, Zotero adds a leading space to the actual file name, although in Zotero it is displayed correctly and the link to the file created correctly (i.e. the citation entry in Zotero is linked to the file).

I use to following syntax for file renaming:

{{ if firstCreator == creators }} {{ firstCreator suffix= " " }}
{{else}} {{ creators join = "_" max = "1" suffix=" etal " }}{{ endif }}
{{ year suffix=" - " }} {{ title truncate="100" }}

After adding a PDF etc. and automatic renaming, the file name is displayed correctly in Zotero: i.e. "Pauper etal 2023 - Blablabla….pdf"

However, the actual file is renamed to: " Pauper etal 2023 - Blablabla….pdf"

This is annoying.
It makes finding the actuals files outside Zotero complicated, for instance because the file are not sorted correctly with older files (that have no leading space).
The only workaround I have at the moment is
- locate the actual file (in Finder or File Explorer)
- manually delete the leading space
- re-locate / re-link the file to the citation in Zotero manually.

Only using {{ firstCreator }} or {{ creators }} without an IF condition does not add an unwanted leading space to the file name.

Does anyone know how to solve this?
Is this a bug in Zotero's native renaming?
Sign In or Register to comment.