Is not a whitelisted directory

Hi all,
Can anyone offer me some idea why I get the above error when im trying to tweet an image. here is my code

Blockquote

alias: first day info
description: ‘’
trigger:

  • platform: time
    at: ‘00:10:00’
    condition:
    action:
  • service: script.twitter_notify_image
    data_template:
    tweet: >-
    Its a new month, so this is a good time to remind you that I am powered
    by #homeassistant.
    image: |-
    image: >- {{ [ “/config/www/tweet_images/newmonth1.jpg”,
    “/config/www/tweet_images/newmonth2.jpg”] | random }}
    mode: single

Blockquote

I have the following code in my config script

Blockquote

allowlist_external_dirs:

  • /config/www
    ive also tried replacing the allowlist to whitelist etc. but i always end up with

Blockquote

image: >- /config/www/tweet_images/newmonth2.jpg’ is not a whitelisted directory can anyone point me in the right direction .

Thanks

Did you check the validity of the template used? I think that there may be some issues with the template. Can you try this?

{{ [ '/config/www/tweet_images/newmonth1.jpg', '/config/www/tweet_images/newmonth1.jpg'] | random }}

There should be no need to whitelist /www

Have you restarted since creating that directory?

Hi, thanks for the help it was my template that was causing me the problems. Now fixed

Thanks

1 Like