Matrix image Path not allowed

I just started trying to use the Matrix Integration, and I seem to have hit a roadblock trying to send an image.

    action: notify.matrix_test
    metadata: {}
    data:
      message: "This is the message"
      data:
        images:
          - /local/garage.jpg

The error’s I receive indicated ‘Path not allowed’. The message itself sends just find. Any suggestions would be appreciated.

Logger: homeassistant.components.matrix
Source: components/matrix/__init__.py:468
integration: Matrix (documentation, issues)
First occurred: October 26, 2024 at 9:30:34 PM (31 occurrences)
Last logged: 7:23:41 AM

Path not allowed: https://m.media-amazon.com/images/M/MV5BZTIwYjk2YjItN2UwMS00ZDM2LWE0MGUtN2Y2MDU3ZDc3NTJhXkEyXkFqcGc@._V1_FMjpg_UX1000_.jpg
Path not allowed: /local/garage.jpg
Path not allowed: https://ha.<redacted>.com/local/garage.jpg
Path not allowed: http://<local_ip_redacted>:8123/local/garage.jpg
Path not allowed: /www/garage.jpg

Hi @coolhand,

I guess you need to add the following values to your configuration.yaml

homeassistant:
    allowlist_external_dirs:
      - '/local/'

as it is written here: Matrix - Home Assistant at the very end.

Hope that helps :slight_smile:

I’m just trying similar things but with external urls and I’m also getting the same error. But for local files - I hope - it will work like that :slight_smile:

Thanks @Schilli I’ll take a look when I get a chance. Please post your results if you get it working well. I’ll do the same.

For me it is working like this:

configuration.yaml

homeassistant:
  allowlist_external_urls:
    - "https://your.ha.url"
  allowlist_external_dirs:
    - /tmp

and within an automation I do have the following actions:

  - action: downloader.download_file
    metadata: {}
    data:
      overwrite: true
      url: >-
        https://your.ha.url{{
        states.camera.garage_snapshot.attributes.entity_picture }}
      filename: ring.garage.ding.jpg
  - action: notify.matrix_notify
    data:
      message: Someone is at the door
      data:
        images:
          - /tmp/ring.garage.ding.jpg

I was trying it directly - without downloading before - but that was not working.