I added to local config:
$conf['sync_chars_regex'] = '/^[a-zA-Z0-9+-_.,; !@#$%^&\[\]\(\)\'ÀÁÂÃÄÅçğıİöşüÇĞÖŞŠÜąāàáâãäåæÒÓÔÕÖØòóôõöøÈÉ@;ÊËèéêëÇçÌÍÎÏìíîïŁÙÚÛÜùúûüÿÑñń]+$/';
So the ampersand character (&) will be accepted for folder and filenames, but thumbnails and other picture sizes are not being created. I checked "_data/i/galleries/" and they are not there.
Here is a gallery showing this. There are 9 with & in the name. 7 have thumbnails and 2 do not. [bold]The 2 that do not are larger images than the other 7.[/bold]
https://brucejohnson.ca/wallpaper/index … ategory/42
Is this an issue with Piwigo or ImageMagick? Can it be fixed? I would hate to have to do a search and replace through 18,000 files to replace the ampersand!
Environment
Piwigo 13.8.0 Check for upgrade
Installed on 13 November 2023, 1 day ago
Operating system: Linux
PHP: 8.1.24 (Show info) [2023-11-15 01:02:57]
MySQL: 5.7.44 [2023-11-14 17:02:57]
Graphics Library: ImageMagick 7.1.0-2
Cache size 184.83 MB calculated right now Refresh
Activated plugin list 1
LocalFiles Editor
Last edited by Windrider6 (2023-11-15 02:21:41)
Offline
Yes, & ampersand in file names can lead to problems, as it is an URI reserved character. Also, remove the ' apostrophe from the expression, even if \' escaped there it does not work and will lead to problems if it actually occurred in a file name. Citing from include/config_default.inc.php:
// Permitted characters for files/directories during synchronization.
// Do not add the ' U+0027 single quote apostrophe character, it WILL make some
// SQL queries fail. URI reserved characters (see
// https://tools.ietf.org/html/rfc3986#section-2.2 ) MAY make things fail, this
// is known for example for the & character leading to a query parameter
// separator if the resulting URI path is not urlencoded.
Btw, in the expression \(\) are unnecessarily escaped, within a [] character set characters other than ] don't need to be escaped, it doesn't hurt though. Also, the +-_ part means all characters in the range between + (0x43) and _ (0x95); to match a literal - minus character place it at the beginning of the character set expression, or at an "odd" (starting) position after a closed range expression, e.g. this would be ok:
[a-zA-Z0-9-+_
You also want to use the "'u' regex option to have PHP interpret the expression as UTF-8 string instead of ASCII" if you are using UTF-8 text encoding (which you hopefully do).
Read the docs in include/config_default.inc.php
Offline
Thank you erAck.
I have changed sync_chars_regex to:
$conf['sync_chars_regex'] = '/^[a-zA-Z0-9-+_.,; ‘!@#$%^()\[\]ÀÁÂÃÄÅąāàáâãäåæßẞÇçÈÉÊËèéêëĞğÌÍÎÏİıìíîïŁÑñńöÖÒÓÔÕÖØòóôõöøŞŠşÙÚÛÜùúûüÿ]+$/u';
And will rename all files and directories:
- replace ampersand & with plus +
- replace regular single quote ' with angled single quote ‘
Now the only problem I have left is that pesky 403 Error when I "apply automatic sort order".
[Forum, topic 32308] Automatic sort order gives 403 Forbidden error
Offline