🐛 Fix event ICS download button file content (#1390)

This commit is contained in:
Simon 2024-10-11 18:30:35 +02:00 committed by GitHub
parent e592484616
commit 71dc64abf5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -119,13 +119,11 @@ export function AddToCalendarButton({
<DropdownMenuSeparator />
<DropdownMenuItem
onClick={() => {
const res = ics(calendarEvent);
const data = ics(calendarEvent);
// download the file
const blob = new Blob([res], { type: "text/calendar" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.setAttribute("href", url);
link.setAttribute("href", data);
link.setAttribute(
"download",
`${title.toLocaleLowerCase().replace(/\s/g, "-")}.ics`,