Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image attachments sent to ntfy with apprise are broken #890

Closed
TheRealAlexV opened this issue Jun 19, 2023 · 3 comments
Closed

Image attachments sent to ntfy with apprise are broken #890

TheRealAlexV opened this issue Jun 19, 2023 · 3 comments

Comments

@TheRealAlexV
Copy link

TheRealAlexV commented Jun 19, 2023

馃摚 Notification Service(s) Impacted
ntfy

馃悶 Describe the bug
When sending a notification with an attachment to ntfy either via the apprise cli or web api, the attachment within ntfy is not able to be opened due to invalid format issues. (according to Windows.). If I send the same test using ntfy's publishing tool on it's webui, the same test message displays the image fine.

I notice in ntfy when I click on the download link for the file, the file extension is .bin; which I assume is because there is an issue determining the mime type.

I've tried uploading multiple image files using both local and remote url's with the same result.

馃挕 Screenshots and Logs

I used https://fileinfo.com/img/ss/xl/jpeg_43-2.jpg as an example image.
Attached to this post (jpeg_43-2) is the resulting file thats uploaded to ntfy with what I assume is an invalid or missing mime type.

First Attempt:

root@1e15479f8670:/# apprise -vvv --title="testing" --body="see attached" --attach=https://fileinfo.com/img/ss/xl/jpeg_43-2.jpg ntfys://TOKENTOKENTOKEN@notify.myselfhosted.lab/test_alerts
2023-06-19 13:00:48,100 - DEBUG - Loaded ntfy URL: ntfys://t...T@notify.myselfhosted.lab/test_alerts?priority=default&mode=private&image=yes&auth=token&format=text&overflow=upstream&rto=4.0&cto=4.0&verify=yes
2023-06-19 13:00:48,101 - DEBUG - Loading attachment: https://fileinfo.com/img/ss/xl/jpeg_43-2.jpg
2023-06-19 13:00:48,105 - DEBUG - HTTP POST URL: https://fileinfo.com/img/ss/xl/jpeg_43-2.jpg (cert_verify=True)
2023-06-19 13:00:48,221 - DEBUG - Preparing ntfy attachment https://fileinfo.com/img/ss/xl/jpeg_43-2.jpg?rto=4.0&cto=4.0&verify=yes&cache=yes
2023-06-19 13:00:48,221 - DEBUG - ntfy POST URL: https://notify.myselfhosted.lab/test_alerts (cert_verify=True)
2023-06-19 13:00:48,221 - DEBUG - ntfy Payload: {'title': 'testing', 'message': 'see attached', 'filename': 'jpeg_43-2.jpg'}
2023-06-19 13:00:48,221 - DEBUG - ntfy Headers: {'User-Agent': 'Apprise', 'Authorization': 'Bearer TOKENTOKENTOKEN', 'X-Icon': 'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-256x256.png'}
2023-06-19 13:00:48,355 - INFO - Sent ntfy notification to 'https://notify.myselfhosted.lab/test_alerts'.

Server Logs:

apprise-api  | 2023-06-19 07:27:08,454 [INFO] apprise: Loaded 1 entries from memory://
apprise-api  | 2023-06-19 07:27:08,522 [INFO] apprise: Sent ntfy notification to 'https://notify.vaninollc.com/test_alerts'.
apprise-api  | [pid: 134|app: 0|req: 4/4] 10.100.2.200 () {42 vars in 772 bytes} [Mon Jun 19 07:27:08 2023] POST /notify/apprise => generated 230 bytes in 73 msecs (HTTP/1.1 200) 6 headers in 224 bytes (2 switches on core 0)

Second Attempt:

root@1e15479f8670:/# apprise -vvv --body="Test Message" apprise://10.100.0.9:8000/apprise/?tags=all --attach=https://fileinfo.com/img/ss/xl/jpeg_43-2.jpg
2023-06-19 13:11:22,130 - DEBUG - Loaded Apprise API URL: apprise://10.100.0.9:8000/a...e/?method=form&format=text&overflow=upstream&rto=30.0&cto=4.0&verify=yes&tags=all
2023-06-19 13:11:22,130 - DEBUG - Loading attachment: https://fileinfo.com/img/ss/xl/jpeg_43-2.jpg
2023-06-19 13:11:22,135 - DEBUG - HTTP POST URL: https://fileinfo.com/img/ss/xl/jpeg_43-2.jpg (cert_verify=True)
2023-06-19 13:11:22,249 - DEBUG - Apprise API POST URL: http://10.100.0.9:8000/notify/apprise (cert_verify=True)
2023-06-19 13:11:22,249 - DEBUG - Apprise API Payload: {'title': '', 'body': 'Test Message', 'type': 'info', 'format': 'text', 'tag': ['all']}
2023-06-19 13:11:22,422 - INFO - Sent Apprise API notification; method=form.

Server logs:

apprise-api  | 2023-06-19 08:11:22,257 [INFO] apprise: Loaded 1 entries from memory://
apprise-api  | 2023-06-19 08:11:22,420 [INFO] apprise: Sent ntfy notification to 'https://notify.vaninollc.com/test_alerts'.
apprise-api  | [pid: 134|app: 0|req: 15/15] 172.30.0.1 () {36 vars in 554 bytes} [Mon Jun 19 08:11:22 2023] POST /notify/apprise => generated 182 bytes in 171 msecs (HTTP/1.1 200) 4 headers in 178 bytes (8 switches on core 0)

馃捇 Your System Details:

  • OS: Ubuntu 22.04
  • Running apprise docker:
  apprise:
   image: caronc/apprise:latest
   container_name: apprise
   volumes:
     - ./fs/apprise/config:/config
     - ./fs/apprise/attach:/attach
     - ./fs/apprise/plugins:/plugins
   ports:
     - 8000:8000
   restart: unless-stopped

Setting most permissive permissions for testing:

root@notify:~/notify# setfacl -d -m g::rwx ./fs/apprise/*
root@notify:~/notify# setfacl -d -m o::rwx ./fs/apprise/*
root@notify:~/notify# ls -la ./fs/apprise/
total 20
drwxr-xr-x  5 root root 4096 Jun 19 13:36 .
drwxr-xr-x  4 root root 4096 Jun 18 12:47 ..
drwxrwxrwx+ 2 root root 4096 Jun 19 13:36 attach
drwxrwxrwx+ 3 root root 4096 Jun 18 16:13 config
drwxrwxrwx+ 2 root root 4096 Jun 19 13:36 plugins
@TheRealAlexV
Copy link
Author

Also just tried it with mailrise to the same result.

@caronc
Copy link
Owner

caronc commented Jun 20, 2023

This is a duplicate of this issue here.

@caronc
Copy link
Owner

caronc commented Jul 1, 2023

This issue was resolved now in #892 ; closing off ticket

@caronc caronc closed this as completed Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants