mirror of
https://github.com/binwiederhier/ntfy.git
synced 2026-05-09 16:35:53 +02:00
[GH-ISSUE #268] Support Content-Type: text/html #210
Labels
No labels
ai-generated
android-app
android-app
android-app
🪲 bug
build
build
dependencies
docs
enhancement
enhancement
🔥 HOT
in-progress 🏃
ios
prio:low
prio:low
pull-request
question
🔒 security
server
server
unified-push
web-app
website
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ntfy#210
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @unai-ndz on GitHub (May 22, 2022).
Original GitHub issue: https://github.com/binwiederhier/ntfy/issues/268
I'm trying to send an html file as an attachment.
This does not work, only the first 4 characters get sent.
This works, but when opening the file it gets opened as a normal text file without rendering the html (When opening the link
https://ntfy.sh/file/example.html) or browser apps are not available in the list of apps to open it (Android)I'm doing something wrong?
@binwiederhier commented on GitHub (May 22, 2022):
The fact that the PUT doesn't work is very dubious. Maybe show the curl details with -v?
The fact that the HTML is not rendered is a feature, not a big ;-) Rendering untrusted HTML in the browser is a huge security risk: https://github.com/binwiederhier/ntfy/blob/main/util/content_type_writer.go#L28
I suppose on your own server that kogix does not apply anymore, though. Is this your own server? I suppose I could make this a flag in the config if this is important to you.
@unai-ndz commented on GitHub (May 22, 2022):
I figured out the issue with PUT. When providing the
-doption the attachment also getsContent-Length: $lenght_of_d.When adding an attachment the message gets replaced by
You received a fileanyways so it's useless to set both.Right now I'm just testing it but if I will self-host if I keep using it.
I would argue that if you trust the app you may as well trust the server but I agree that some nasty things could be done so security wise seems reasonable.
Alternatives:
@binwiederhier commented on GitHub (May 22, 2022):
Just looked at the
curlagain. You cannot do-dand-Tat the same time. You can only set the body once. If you want to set the message and upload a file, you can do-H "Message: My message"(header) or?message=My+message(query param). All parameters can be headers or query parameters (see https://ntfy.sh/docs/publish/#list-of-all-parameters)@binwiederhier commented on GitHub (May 22, 2022):
Are you just trying to format the message? Then an attachment is definitely not the right thing to do.
@unai-ndz commented on GitHub (May 23, 2022):
Sorry for the bother with curl, I don't use it very often.
Formating the message is what I was looking for but tried to use attachments as a compromise. nfty looks pretty good so I was trying to make it work.
@binwiederhier commented on GitHub (May 23, 2022):
If Markdown (bold, italics, underline, link) is enough, I'm happy to implement this. Maybe create a new ticket and close this one if you'd like that. I'm sure other people would like Markdown support too.
@binwiederhier commented on GitHub (May 27, 2022):
As I said, please feel free to create another ticket for Markdown support. I'm closing this ticket. Thank you for using ntfy 👍