Issue with odd characters in filenames used to generate virtual pages

Hi,

I have used this setup to generate virtual pages for a lightbox on a site: Virtual pages from image gallery | Kirby CMS.

I have recently hit an issue with odd characters in a filename causing problems. By the looks of it the name included a comma and also an ampersand.

Can I adjust this line in the linked resource:

'slug'     => $image->name(),

To something that would sanitise this a bit more? Would safeBasename be something to use here?

Intesting, because Kirby sanitzes file name on upload, so guess that is a file manually uploaded directly to the file system?

Yes, you can sluggify the filename with Str::slug(), then when trying to find the file, again, you need to take that into account.

No the files were uploaded through Kirby.

The generated URL looked like this (apologies, I said ampersand and comma but it was actually a dot and a dash):

https://rowlesgallery.com/art-and-artists/helen-bradley/miss-winterbottom-taught-the-infants/161.-bradley-miss-winterbottom-taught-the-infants.jpg

It’s wierd I am not sure what happened, I am going to see if I can get the original uploaded file from the client to see if that helps.