Folder Watch Notification file name with spaces

I have Folder Watch running to trigger on new files in my media folder. It works fine if the filename has no space - but my camera sends the FTP file name over with a space in it. Looking for a way to encode the filename so it can be included in the notifications (I get 404 errors on the image name if it has a space). Hoping someone can provide the code to encode. the filename part of the file - the folder works ok:

This code works as long as no space in file name:

  - action: notify.all_my_devices
    metadata: {}
    data:
      message: Duo2 Image
      title: Duo2 New Capture
      data:
        image: /media/local/{{trigger.event.data.folder}}/{{trigger.event.data.file}}

This code does not work (at all) - looking for a soln:

  - action: notify.all_my_devices
    metadata: {}
    data:
      message: Duo2 Image
      title: Duo2 New Capture
      data:
        image: >-
          /media/local/{{trigger.event.data.folder}}/"encodeURIComponent({{trigger.event.data.file}})"

thanks

Hi Julian,

This maybe? I have nit used it… url_encode
Templating - Home Assistant.
&
Template Designer Documentation — Jinja Documentation (3.0.x)