is there any built-in way to encode malicious file name characters when getting an asset URL through assetHandle.getUrl('transformationName')
?
My system contains files with names such as /assets/images/foo/_transformationName/105 Flippy Dolphin 31 (F60).jpg
and escaping the whole string escapes also slashes.
I can assemble a valid URL from asset.directory
and asset.filename
, but that cuts off access to image transformations.
I do realize I could create a twig extension or explode the string using regular expressions, do my thing and join it back, but I have a feeling this might use some approach more aimed at fixing the cause, not the consequence. The .getUrl()
method might be able to return a web-safe value somehow maybe?