caronc / apprise

Apprise - Push Notifications that work with just about every platform!
https://hub.docker.com/r/caronc/apprise
BSD 2-Clause "Simplified" License
10.9k stars 384 forks source link

Could not access attachment file (Windows issue ?) #1129

Closed pokemaster974 closed 1 month ago

pokemaster974 commented 1 month ago

:mega: Notification Service(s) Impacted All

:lady_beetle: Describe the bug When I try to add an attachment file, Apprise can't send it because it searches to another location after formatting the path.

import apprise
import logging

logging.basicConfig(level=logging.DEBUG)
apobj = apprise.Apprise()

apobj.add('discord://xxx')

apobj.notify(
    body='what a great notification service!',
    title='my notification title',
    attach='D:\placeholder.png',
)

Same result if I try to attach file via

attach = apprise.AppriseAttachment()
attach.add('D:\placeholder.png',)

Also tried with CLI and resulting in same ERROR with same formatted path.

Attaching a link like https://i.redd.it/my2t4d2fx0u31.jpg?name=FlyingToMars.jpg works.

DEBUG:apprise:Posting Discord attachment https://i.redd.it/my2t4d2fx0u31.jpg?rto=4.0&cto=4.0&verify=yes&cache=yes&name=flyingtomars.jpg
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): discord.com:443
DEBUG:urllib3.connectionpool:https://discord.com:443 "POST /api/webhooks/xxx HTTP/1.1" 200 None
INFO:apprise:Sent Discord attachment.

:bulb: Screenshots and Logs

DEBUG:apprise:Notification Plugin 103(s) and 147 Schema(s) loaded in 0.2800s
DEBUG:apprise:Loaded Discord URL: discord://xxx
DEBUG:apprise:Loading attachment: D:\placeholder.png
DEBUG:apprise:Attachment Plugin 2(s) and 3 Schema(s) loaded in 0.0010s
DEBUG:apprise:Discord POST URL: https://discord.com/api/webhooks/xxx (cert_verify=True)
DEBUG:apprise:Discord Payload: {'tts': False, 'wait': True, 'avatar_url': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-256x256.png', 'username': 'xxx', 'content': 'my notification title\r\nwhat a great notification service!'}
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): discord.com:443
DEBUG:urllib3.connectionpool:https://discord.com:443 "POST /api/webhooks/xxx HTTP/1.1" 204 0
INFO:apprise:Sent Discord notification.
INFO:apprise:Posting Discord Attachment None
DEBUG:apprise:Discord POST URL: https://discord.com/api/webhooks/xxx (cert_verify=True)
DEBUG:apprise:Discord Payload: {'tts': False, 'wait': True, 'avatar_url': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-256x256.png', 'username': 'xxx'}
ERROR:apprise:Could not access attachment file://D%3A%5Cplaceholder.png.

:computer: Your System Details:

:crystal_ball: Additional context Add any other context about the problem here.

pokemaster974 commented 1 month ago

My bad, seems to work now. I don't know what was wrong.

INFO:apprise:Posting Discord Attachment placeholder.png
DEBUG:apprise:Discord POST URL: https://discord.com/api/webhooks/xxx(cert_verify=True)
DEBUG:apprise:Discord Payload: {'tts': False, 'wait': True, 'avatar_url': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-256x256.png', 'username': 'xxx'}
DEBUG:apprise:Posting Discord attachment file://D%3A%5Cplaceholder.png
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): discord.com:443
DEBUG:urllib3.connectionpool:https://discord.com:443 "POST /api/webhooks/xxx HTTP/1.1" 200 None
INFO:apprise:Sent Discord attachment.